diff --git a/plugins/synced_folders/rsync/helper.rb b/plugins/synced_folders/rsync/helper.rb index acc0a6cf0..812150c7b 100644 --- a/plugins/synced_folders/rsync/helper.rb +++ b/plugins/synced_folders/rsync/helper.rb @@ -72,9 +72,14 @@ module VagrantPlugins args = Array(opts[:args]) if opts[:args] args ||= ["--verbose", "--archive", "--delete", "-z"] - # On Windows, we have to set the chmod flag to avoid permission issues - if Vagrant::Util::Platform.windows? + # On Windows, we have to set a default chmod flag to avoid permission issues + if Vagrant::Util::Platform.windows? && !args.any? { |arg| arg.start_with?("--chmod=") } + #Ensures that all non-masked bits get enabled args << "--chmod=ugo=rwX" + + #Remove the -p option if --archive is enabled (--archive equals -rlptgoD) + #otherwise new files will not have the destination-default permissions + args << "--no-perms" if (args.include? "--archive") || (args.include? "-a") end # Build up the actual command to execute