any backup utilities for ACLs?

Karl Vogel vogelke at pobox.com
Sat Aug 6 22:16:19 GMT 2005


>> On Sat, 30 Jul 2005 13:17:36 -0400 (EDT), 
>> Dru <dlavigne6 at sympatico.ca> said:

D> I've enabled ACL support on a 5.4-RELEASE system and have no problems
D> creating and modifying ACLs.  However, I can't seem to find a backup
D> program that will actually restore the ACLs.  I've tried bsdtar, pax,
D> and star.  Has anyone had any success in backing up and restoring ACLs?

   According to http://www.onlamp.com/pub/a/bsd/2003/08/14/freebsd_acls.html
   the archivers/star port supports ACLs; did you use the port or compile
   from separate source?

   Apart from that, all I can think of is to save the ACLs using getfacl
   and then restore them later using something like the script below.

-- 
Karl Vogel                      I don't speak for the USAF or my company

The ultimate result of shielding men from the effects of folly is to
fill the world with fools.                              --Herbert Spencer

---------------------------------------------------------------------------
#!/usr/bin/perl
# read getfacl output, write setfacl commands.
#
# Sample input:
#    #file:f1
#    #owner:1001
#    #group:1001
#    user::rwx
#    group::r--
#    group:mail:rw-
#    mask::rw-
#    other::r--
#    
#    #file:f2
#    #owner:1001
#    #group:1001
#    user::rw-
#    group::r--
#    other::r--
#
# Sample output:
#    setfacl -m user::rwx,group::r--,group:mail:rw-,mask::rw-,other::r-- f1
#    setfacl -m user::rw-,group::r--,other::r--, f2

$cmd = 'setfacl -m';
$opt = '';

while (<>) {
    chomp;

    $file = $1 if /^#file:(.*)/;
    next if /^#owner:/;
    next if /^#group:/;

    if (length($_)) {
        $opt .= "$_," unless /^#/;
    } else {
        chop ($opt);
        print "$cmd $opt $file\n";
        $opt = '';
    }
}

print "$cmd $opt $file\n" if length($opt);
exit(0);



More information about the freebsd-questions mailing list