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?
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.If you don't want to install another program, you can backup the ACLs separately:
This dumps all the ACLs from
somedir
into the fileacls.txt
.To restore, use:
beside star you can use bsdtar