Rsync on Windows: wrong permissions for created directories

I'm trying to push changes to my server through ssh on windows (cygwin) using rsync. The command I am using is:

rsync -rvz -e ssh /cygdrive/c/myfolder/ [email protected]:/srv/www/prj112/myfolder/

/srv/www/prj112/myfolder/ is owned by rsyncuser. My problem is that eventhough with rsync the sub directories are create as they publish, each directory is assigned default permission of d--------- so rsync fails to copy any files inside it.

How do I fix this?


The option to ignore NTFS permissions has changed in Cygwin version 1.7. This might be what's causing the problem.

Try adding the 'noacl' flag to your Cygwin mounts in C:\cygwin\etc\fstab, for example:

none /cygdrive cygdrive user,noacl,posix=0 0 0

You can pass custom permissions via rsync using the 'chmod' option:

rsync -rvz --chmod=ugo=rwX -e ssh source destination

Your problem stems from the fact that the Unix permissions on that directory really are 0. All of the access information is stored in separate ACLs, which rsync does not copy. Thus, it sets the permissions on the remote copy to 0, and, obviously, is unable to write to that directory afterwards. You can run

chmod -R 775

on that directory, which should fix your rsync problem.

After a look at the manpage I can tell that the chmod param is available in rsync since version ~2.6.8. But you have to use --chmod=ugo=rwX in combination with rsync -av

You should also try this command:

rsync -av <SOURCE_DIR> [email protected]:/srv/www/prj112/myfolder

It would work on Linux at least. And note that rsync does not need to mention ssh--at least on Linux.

But if all fails and just to give an option you may take a look at this ready packed-up tool cwRsync


if you deploy a site from windows (for ex. octopress use rsync) it's possible set permission to 775 adding multiple chmod command:

   rsync -avz --chmod=ug=rwx --chmod=o=rx -e ssh