Skip site navigation (1)Skip section navigation (2)
Date:      6 Aug 2005 18:13:44 -0400
From:      "Karl Vogel" <vogelke@pobox.com>
To:        dlavigne6@sympatico.ca
Cc:        freebsd-questions@freebsd.org
Subject:   Re: any backup utilities for ACLs?
Message-ID:  <20050806221344.52679.qmail@kev.nowhere.usa>
In-Reply-To: <20050730125158.V542@dru.domain.org> (message from Dru on Sat, 30 Jul 2005 13:17:36 -0400 (EDT))
References:  <20050730125158.V542@dru.domain.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>> On Sat, 30 Jul 2005 13:17:36 -0400 (EDT), 
>> Dru <dlavigne6@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);




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050806221344.52679.qmail>