rsync file permissions on windows
(from http://www.samba.org/ftp/rsync/rsync.html)
In summary: to give destination files (both old and new) the source permissions, use --perms
.
To give new files the destination-default permissions (while leaving existing files unchanged), make sure that the --perms
option is off and use --chmod=ugo=rwX
(which ensures that all non-masked bits get enabled).
If you'd care to make this latter behavior easier to type, you could define a popt alias for it, such as putting this line in the file ~/.popt (the following defines the -Z option, and includes --no-g to use the default group of the destination dir):
rsync alias -Z --no-p --no-g --chmod=ugo=rwX
Cygwin's "posix" security has caused me lots of problems with Windows NTFS file permissions - even using --no-perms
with rsync.
I found that newly-created files/folders don't properly inherit default permissions, but every file/folder ends up with lots of <not inherited>
entries in the Windows file/folder Advnanced security tab. (And this problem is not just rsync-related).
I found this related post and this link both very helpful in how to resolve these problems using the noacl
option in cygwin's /etc/fstab
file. The downside of this solution is that cygwin loses the ability to set file/folder permissions, but in many cases this is not important.
(Googling this topic you'll probably find references to setting the CYGWIN=NONTSEC environment variable, but this is for cygwin v1.5 and doesn't work in cygwin v1.7 onwards.)
On Windows with DeltaCopy I could make it work with:
rsync --perms --chmod=a=rw,Da+x ...
It worked even with --recursive