Preserve ACLs with rsync

19,881

I will partially answer my own question.

I installed Lubuntu for my children's use on an older PC. I decided to see if Lubuntu's version of rsync would function properly. The version of rsync on Lubuntu 16.04.1LTS is 3.1.1 protocol version 31.

rsync -aAX /source/filename /destination/
rsync -aAX /source/filename /destination/filename
rsync -aAX /source/filename /destination/newfilename

all work fine in Lubuntu.

Either the version of rsync on Ubuntu 14.04LTS (3.0.1 if I recall properly) has a bug, or somewhere along the way I messed up a configuration file or similar.

As I will be installing Ubuntu 16.04.1LTS in place of Ubuntu 14.04LTS, I will not spend any further time attempting to resolve the problem.

Regards.

Share:
19,881

Related videos on Youtube

user2175064
Author by

user2175064

Updated on September 18, 2022

Comments

  • user2175064
    user2175064 over 1 year

    Sorry, but I can find no solution to this apparent simple problem searching online and this forum.

    I have a simple need: copy a directory and its contents to another local location, preserving ACLs and xAttr. This should be quite straight forward per the man page by use of -A and -X options:

    rsync -aAX /source/directory /destination/directory
    

    But this fails to preserve them. A simple use of 'cp' works though.

    cp -a /source/directory /destination/directory
    

    I have tried various other combinations, even as sudo without success...

    sudo rsync -rA /source/directory /destination/directory
    

    I am using Ubuntu 14.04LTS; I am sure that I have ACLs, as I have set the ACLs using 'setfacl' and 'getfacl'

    setfacl -R -m "g:gp2:rw" MyDirectoryOfInterest
    

    where getfacl reveals ACLs are in use:

    >>getfacl /source/DirectoryOfInterest
    getfacl: Removing leading '/' from absolute path names
    
    # file: source/DirectoryOfInterest
    # owner: myusername
    # group: myusername
    user::rwx
    user:usr1:rwx
    user:usr2:rw-
    user:usr3:r--
    group::rwx
    group:gp1:r--
    group:gp2:rw-
    group:gp3:rwx
    mask::rwx
    other::rwx
    

    Note: both source and destination directories are on the same drive, and even in the same directory, with the destination directory simply appending the number '2'. e.g. /home/username/Car and /home/username/Car2.

    Note: rsync will run, but will not assign any ACLs and xAttr

    >>getfacl /home/myusername/test123/Cars2
    getfacl: Removing leading '/' from absolute path names
    # file: home/myusername/test123/Cars2
    # owner: myusername
    # group: myusername
    user::rwx
    group::rwx
    other::r-x
    

    I need to use rsync, as eventually I wish to utilize this with a NAS that requires use of rsync for my needs. Any help would be appreciated.

    • Byte Commander
      Byte Commander over 7 years
      Did you try sudo rsync -aAX ...? I only see sudo rsync -rA ... in your question.
    • user2175064
      user2175064 over 7 years
      Yes, I did try 'sudo rsync -aAX ...' and numerous others such as '-AX', '-a', '-rptgoAX', '-A' all with and without sudo. They all generate results similar to the 'getfacl' output above, with the difference only being the owner & group are 'root' when sudo is used.