Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rsync fails on Windows with permission denied #3256

Closed
ccapndave opened this issue Mar 18, 2014 · 6 comments
Closed

Rsync fails on Windows with permission denied #3256

ccapndave opened this issue Mar 18, 2014 · 6 comments

Comments

@ccapndave
Copy link

It seems that this is because rsync on Windows is trying to copy NTFS file permissions into the virtual machine, ending up with no permissions at all. Its explained further in http://stackoverflow.com/questions/5798807/rsync-permission-denied-created-directories-have-no-permissions

As a temporary workaround I have added:

"--chmod=ugo=rwX",

into <Vagrant>\embedded\gems\gems\vagrant-1.5.1\plugins\synced_folders\rsync\helper.rb just after the line saying "-e", rsh,, but obviously this isn't a permanent solution.

The full error is given below:

==> default: Rsyncing folder: /cygdrive/d/Projects/server/ => /vagrant
==> default:   - Exclude: [".vagrant/", ".git/", "app/bootstrap.php.cache", "app/cache/", "vendor/", "build/", "web/bundles/", "web/css/", "web/js/", "web/build.js", "app/logs/", ".idea"]
There was an error when attempting to rsync a synced folder. Please inspect the error message below for more info.

Host path: /cygdrive/d/Projects/server/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z -e ssh -p 2200 -o StrictHostKeyChecking=no -i 'C:/Users/Dave/.vagrant.d/insecure_private_key' --exclude .vagrant/ --exclude .git/ --exclude app/bootstrap.php.cache --exclude app/cache/ --exclude vendor/ --exclude build/ --exclude web/bundles/ --exclude web/css/ --exclude web/js/ --exclude web/build.js --exclude app/logs/ --exclude .idea /cygdrive/d/Projects/Playpearls/bitcoinliveroulette/server/ vagrant@127.0.0.1:/vagrant
Error: rsync: failed to modify permissions on "/vagrant/.": Permission denied (13)
rsync: opendir "/vagrant/." failed: Permission denied (13)
rsync: recv_generator: failed to stat "/vagrant/.gitignore": Permission denied (13)
rsync: recv_generator: failed to stat "/vagrant/.travis.yml": Permission denied (13)
rsync: recv_generator: failed to stat "/vagrant/composer.json": Permission denied (13)
rsync: recv_generator: failed to stat "/vagrant/composer.lock": Permission denied (13)
rsync: recv_generator: mkdir "/vagrant/app" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/vagrant/bin" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/vagrant/src" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/vagrant/web" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1165) [sender=3.1.0]
@mzeis
Copy link

mzeis commented Mar 18, 2014

When playing around with the rsync implementation I also experienced this error but I got it working somehow. I believe the :mount_options settings were helping but I'm not sure.

You could try it:

@lgoral
Copy link

lgoral commented Mar 19, 2014

I have added rsync__args: ["--chmod=ug=rwX,o=rxX"] and now it works

@mitchellh
Copy link
Contributor

Hm, so is the solution here for Vagrant to automatically do this on Windows hosts, you think?

@crankeye
Copy link

I'm using the latest cygwin x64 binaries of rsync and ssh and I can verify the same issue as @ccapndave .

The solution for me was to add
:rsync__args => ["--chmod=ugo=rwX","--verbose", "--archive", "--delete", "-z"]

@mitchellh It makes sense to make this the default for Windows. Currently you can override the default arguments if you needed to adjust the permissions to your own needs. +1 for default Windows behavior.

@mitchellh
Copy link
Contributor

Done. Fixed

@Idealien
Copy link

Idealien commented Apr 2, 2014

I just encountered this - Fresh Win7 (with cygwin for rsync).
Tried applying same changes mitchell referenced in helper file as well as (separately) the mount options and rsync__args listed above.

Both showed the --chmod=ug=rwX,o=rxX addition to the rsync command but kept the permission denied error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants