Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an rsync service that syncs files from remote machine to a machine that drops them on a network drive.

I need the copied files to take on the native permissions of the destination folder.

The sync process runs fine, but after it is finished, I cannot access some of the folders -- Permission Denied.

I am logged in as domain admin; it won't allow me to modify any permissions on said folders, either. What gives?

run command:

rsync.exe  -v -rlt -z --delete "src_path" "dst_path"
share|improve this question
    
what command are you currently using to sync? – John T Nov 12 '09 at 17:10
    
thanks john T. question edited to include command. – avguchenko Nov 12 '09 at 18:44
up vote 17 down vote accepted

(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
share|improve this answer
    
thx a lot. I couldn't remember the right flags to use ... – Vokuhila-Oliba Jan 5 '10 at 18:31

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.)

share|improve this answer
    
Thanks for clearing up NONTSEC. – Ben Challenor Dec 8 '12 at 13:35
    
Editing the /etc/fstab file fixed it for me. I had to use rsync within cygwin instead of another deployment such as DeltaCopy to do this. – Matt Connolly Jan 21 '13 at 2:27

On Windows with DeltaCopy I could make it work with:

rsync --perms --chmod=a=rw,Da+x ...

It worked even with --recursive

share|improve this answer
    
This mostly worked, however, I had to change the --chmod option to include a=rwx so that batch files, etc. would properly execute. – Taylor Gerring Oct 3 '12 at 18:38
    
This is the only option that worked for me. Tried the --no-perms suggested above and the fstab to no avail. This one gave me only some <not inherited> permissions, which were kind of the permissions I wanted and included no Deny permission for the executing user. Thanks! – AronVanAmmers Oct 17 '12 at 10:23
    
DeltaCopy also contains a chmod executable that can fix the permissions afterwards, e.g. chmod -R 777 /cygdrive/g – jnnnnn Nov 13 '12 at 0:25

rsync, at least on Cygwin has the following switch:

-A, --acls preserve ACLs (implies --perms)

My Cygwin version is:

CYGWIN_NT-6.3 1.7.29(0.272/5/3) 2014-04-07 13:46 x86_64 Cygwin

Hope this helps!

share|improve this answer
1  
Welcome to Super User!  Whilst this may theoretically answer the question, for the sake of improvement it would be preferable to include details of how this answers the question (citing a source to back up your claim is a plus). – G-Man Apr 26 '15 at 1:28

The top rated answer only works if you're using rsync over ssh into windows. If you're using the cygwin rsync daemon just using noacl in /etc/fstab doesn't help, for whatever reason it doesn't honor inheritance even if you get rid of user and try noacl,override, etc. This seems to happen if you're rsyncing into a top level drive and use path = /cygdrive/whatever in /etc/rsyncd.conf. Instead, you need to make a separate mount point in /etc/fstab and use that in your rsyncd.conf instead :

D:\     /d_drive  ntfs    binary,posix=0,noacl,user,override      0 0

in /etc/rsyncd.conf, you'd have something like this :

use chroot = yes

[d_drive]
path = /d_drive
comment = d_drive
auth users = someUser
secrets file = /etc/rsyncd.secrets
read only = false
write only = false
list = false
uid = someUser

Then I had to reboot the windows system, just restarting the rsync service alone didn't seem to help, it kept throwing chroot and chdir errors (even though /d_drive was mounted and use chroot = false and I could write to it). Then when you rsync into the windows system use :

cd /local/path/to/copy
rsync -rltD --no-p --no-g --no-o  ./ rsync://someUser@localhost:remotePort/d_drive/
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .