Rsync does not properly set permissions on Windows folder
Asked Answered
O

3

6

I'm using rsync on Windows 7 (in particular, cwrsync). I'm using a simple command as such:

rsync -r --perms --delete /cygdrive/c/Users/Michael/Documents/Personal/ /cygdrive/c/Users/Michael/Documents/Personal_Backup/

The recursive copy works fine, except if I was to (right-click/Properties/Security tab) on any folder created by rsync on the destination; I get the following pop-up message:

The permissions on {folderName} are incorrectly ordered, which may cause some entries to be ineffective.

I also tried the --acls option but get the following error:

recv_acl_access: value out of range: ff rsync error: error in rsync protocol data stream (code 12) at acls.c(690) [Receiver=3.0. rsync: connection unexpectedly closed (9 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(610) [sender=3.0.8]

In any case, I just want to use rsync correctly so that viewing the Security permissions in Windows won't throw an error.

Osteophyte answered 11/7, 2011 at 11:38 Comment(0)
C
3

Michael,

This solution suggests that you should not be using --perms, but using --chmod=ugo=rwX instead.

Good luck!

Dotan

Conaway answered 12/7, 2011 at 4:40 Comment(0)
S
1

One word, Robocopy.

I had exactly the same isues with borked permissions while using cwRsync, tried numerous things but none seemed to work so I gave up eventually.

This is default Windows tool and has similar (for your purpose, the same) feature set.

I discovered it last night and ditched rsync completely. It's built for unix-like's so some sort of bummer is expected on Windows.

This got me started:

http://www.sevenforums.com/tutorials/187346-robocopy-create-backup-script.html

Here's the little backup script I made for myself to mirror my partitions to external drive.

Don't look back for rsync any more.

Stately answered 20/1, 2015 at 16:11 Comment(0)
F
0

I use the now-deprecated cacls to add myself back in after the copy occurs.

rsync -avASPC sourceDir/* destDir
cacls destDir /t /e /r doej
cacls destDir /t /e /g doej:f

Where sourceDir is the source directory and destDir is the destination directory and doej is the username. It would probably be better to use icacls, but I haven't learned it yet.

I also tried robocopy, but I did not have the permissions I needed to make that work, it seems.

Flags used for rsync

 -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
    -r, --recursive             recurse into directories
    -l, --links                 copy symlinks as symlinks
    -p, --perms                 preserve permissions
    -t, --times                 preserve modification times
    -g, --group                 preserve group
    -o, --owner                 preserve owner (super-user only)
    -D                          same as --devices --specials
       --devices               preserve device files (super-user only)
       --specials              preserve special files
 -v, --verbose               increase verbosity
 -S, --sparse                handle sparse files efficiently
 -A, --acls                  preserve ACLs (implies -p, which is also implied by -a)
 -P                          same as --partial --progress
    --progress              show progress during transfer
    --partial               keep partially transferred files
 -C, --cvs-exclude           auto-ignore files in the same way CVS does

Flags used from CACLS

  /T            Changes ACLs of specified files in
  /E            Edit ACL instead of replacing it.
  /R user       Revoke specified user's access rights (only valid with /E).
  /P user:perm  Replace specified user's access rights.
                Perm can be: ...
                           F  Full control
Fertility answered 9/12, 2013 at 23:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.