When using the tar utility to store files in backups one loses the extended ACLs.
Is there some commonly used and not hackish solution (like: create a script that will recrate the ACLs from scratch) to preserve the ACLs?
Actually, I believe the question was not about the (standard) file permission bits, but extended ACL information (see setfacl(1) or acl(5)).
To my knowledge, the unmodified GNU tar ignores ACL information. (The man page for GNU tar 1.15.1 as shipped with RHEL 5.2 mentions switches --acls and --no-acls, but I haven't gotten them to work.)
However, the star program is able to back up and restore ACLs, if you select the exustar format:
Star home page: http://cdrecord.berlios.de/new/private/star.html Star is available in ubuntu, at least.
If you're looking for a simple-to-use yet powerful solution, I'd recommend
Basically, it makes a copy of a source directory to a destination directory but it also saves additional information so you can go back in time to whenever you want.
And, of course, it preserves symlinks, special files, hardlinks, permissions, uid/gid ownership and modification times.
I'm looking for a solution as well so far I found this:
first do a getfactl from my folder
then do a regular tar
when I extract it
do a setfacl for the permissions.
this works for me.
I suggest you to use
The package and command name (under Debian based distributions) is
The 2nd (extract) command restores ACLs.
From the tar Man Page.
It is not actually the act of archiving that alters the access permissions(ACLs), but the act of unpacking them. Tar is very often used to distribute files from one user to another, and so it is thought convenient to apply a users umask when they unpack.
To preserve the files previous permissions, simply ad a p for to your options. For example