4

I'm looking for a practical way to backup data from a server and keep all ACLs and permissions. I've looked at tar, but according to Google tar doesn't keep ACLs . I know rsync can keep ACLs and permissions, but only if the target system supports POSIX ACLs and have the same users. In my case I'm doing the backup to a directory that is located on AFS, so POSIX ACLs are not supported.

At the moment I have solved the problem by writing a script that uses find to recurse through the system (I'm using find because I which to exclude some directories) and saves the permissions and ACLs to a text file. This solution works, but is painfully slow. Is there a better solution?

9
apt-get install star
man star
star -acl -whatever -other -options -you -need

Star is tar with support for extended POSIX headers, that is, the ability to store some extra data about a file in the tar file. The -acl option gets the ACLs; you need it for both archive creation and extraction.

8

If you don't want to install another program, you can backup the ACLs separately:

getfacl -R somedir > acls.txt

This dumps all the ACLs from somedir into the file acls.txt.

To restore, use:

setfacl -R --set-file=acls.txt somedir
  • +1 for something I just didn't know. – Moritz Both Sep 6 '11 at 6:53
2

beside star you can use bsdtar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.