Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
1  
See also this duplicate question. –  Totor Apr 22 '13 at 15:15

3 Answers 3

up vote 9 down vote accepted
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.

share|improve this answer

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
share|improve this answer
    
+1 for something I just didn't know. –  Moritz Both Sep 6 '11 at 6:53

beside star you can use bsdtar

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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