Unix Technical Forum

Backing up ACL's

This is a discussion on Backing up ACL's within the comp.unix.solaris forums, part of the Solaris Operating System category; --> Is there a way to backup the directory ACL's for a directory and all it's subdirectories? I don't want ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > comp.unix.solaris

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-06-2008, 08:03 PM
Chuck
 
Posts: n/a
Default Backing up ACL's

Is there a way to backup the directory ACL's for a directory and all
it's subdirectories? I don't want to backup the ACL's for the files
therein, just directories.

I'm aware of the -p option on tar, but tar will also pick up the files
which I don't really want.
--
To reply by email remove "_nospam"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-06-2008, 08:03 PM
Joerg Schilling
 
Posts: n/a
Default Re: Backing up ACL's

In article <37eon9F575lirU1@individual.net>,
Chuck <skilover_nospam@softhome.net> wrote:
>Is there a way to backup the directory ACL's for a directory and all
>it's subdirectories? I don't want to backup the ACL's for the files
>therein, just directories.
>
>I'm aware of the -p option on tar, but tar will also pick up the files
>which I don't really want.


Sun's tar uses a broken archiveformat for ACLs. It does not work
if the server does not know the names for the uid's.
Sun's tar also fails to extract files correctly if they don't have
ACLs but are located inside a directory with default ACLs.

Better use star ftp://ftp.berlios.de/pub/star/alpha/

star -c -Hexustar -acl pat=*/ . > /tmp/archive.tar



--
EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
js@cs.tu-berlin.de (uni)
schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
URL: http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-06-2008, 08:04 PM
Bernd Haug
 
Posts: n/a
Default Re: Backing up ACL's

In article <37eon9F575lirU1@individual.net>, Chuck wrote:
> Is there a way to backup the directory ACL's for a directory and all
> it's subdirectories? I don't want to backup the ACL's for the files
> therein, just directories.


If you don't want to use star (but Joerg's probably right that you
should) for some reason:

find . -type d -print0 | xargs -0 getfacl

To get output that you can feed to setfacl -f again, assuming findutils
that know /-(print)?0/ parameters.

That output could, e.g., be fed into a file that can be included in the
backup to store human readable ACL information (ASCII is easy to correct
in case of flipped bits).

BTW, a -n argument for getfacl would be really useful (classical
semantics: report numerically what can be reported numerically, in this
case uid/gid) and wouldn't need breaking any interfaces since no such
flag exists now. Should be easy, could hack it myself if OpenSolaris was
out.

lg, Bernd
--
There was only one road back to L.A.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-06-2008, 08:05 PM
Joerg Schilling
 
Posts: n/a
Default Re: Backing up ACL's

In article <slrnd16389.29n.bhau-news@014-220.efkon>,
Bernd Haug <bhau-news@efkon.com> wrote:
>In article <37eon9F575lirU1@individual.net>, Chuck wrote:
>> Is there a way to backup the directory ACL's for a directory and all
>> it's subdirectories? I don't want to backup the ACL's for the files
>> therein, just directories.

>
>If you don't want to use star (but Joerg's probably right that you
>should) for some reason:
>
>find . -type d -print0 | xargs -0 getfacl


Find has no option -print0

You may like to use a command line that is supported by find:

find . -type d -exec getfacl {} +

--
EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
js@cs.tu-berlin.de (uni)
schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
URL: http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-06-2008, 08:05 PM
Chuck
 
Posts: n/a
Default Re: Backing up ACL's

Joerg Schilling wrote:
> In article <37eon9F575lirU1@individual.net>,
> Chuck <skilover_nospam@softhome.net> wrote:
>
>>Is there a way to backup the directory ACL's for a directory and all
>>it's subdirectories? I don't want to backup the ACL's for the files
>>therein, just directories.
>>
>>I'm aware of the -p option on tar, but tar will also pick up the files
>>which I don't really want.

>
>
> Sun's tar uses a broken archiveformat for ACLs. It does not work
> if the server does not know the names for the uid's.
> Sun's tar also fails to extract files correctly if they don't have
> ACLs but are located inside a directory with default ACLs.
>
> Better use star ftp://ftp.berlios.de/pub/star/alpha/
>
> star -c -Hexustar -acl pat=*/ . > /tmp/archive.tar
>
>
>


I think in my case tar will work. All of the users are defined locally,
and though the directories do have default ACL's, all of the files will
have ACLs as well. Thanks for the tip though. If I ever get away from
the current architecture, star may be the way to go.

One thing I don't quite understand is that if ACL's are a posix feature,
why doesn't the posix archiver pax handle them?

--
To reply by email remove "_nospam"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-06-2008, 08:05 PM
Bernd Haug
 
Posts: n/a
Default Re: Backing up ACL's

In article <cuv5pu$mil$1@news.cs.tu-berlin.de>, Joerg Schilling wrote:
> Find has no option -print0


GNU find has. I mentioned "findutils w/ print0/0 argument support".

I generally like GNU find better than Sun, but maybe that's just being
more used to it.

Basically, I like that most GNU utils make it a bit harder to shoot
yourself in the foot; recent GNU rm -r .* doesn't recurse into .. that
easily, and generally fewer utils w/ side effects follow symlinks by
default.

Maybe it's because I'm stupid; but computers give me enough ammo anyway,
so why ask for the cocked shotgun too?

But I digress.

lg, Bernd
--
There was only one road back to L.A.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-06-2008, 08:05 PM
Casper H.S. Dik
 
Posts: n/a
Default Re: Backing up ACL's

Bernd Haug <bhau-news@efkon.com> writes:

>Basically, I like that most GNU utils make it a bit harder to shoot
>yourself in the foot; recent GNU rm -r .* doesn't recurse into .. that
>easily, and generally fewer utils w/ side effects follow symlinks by
>default.


Neither does Solaris "rm".

In Solaris 10, you can even attempt "rm -rf /".

Casper
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-06-2008, 08:06 PM
Chuck
 
Posts: n/a
Default Re: Backing up ACL's

Joerg Schilling wrote:
> In article <37eon9F575lirU1@individual.net>,
> Chuck <skilover_nospam@softhome.net> wrote:
>
>>Is there a way to backup the directory ACL's for a directory and all
>>it's subdirectories? I don't want to backup the ACL's for the files
>>therein, just directories.
>>
>>I'm aware of the -p option on tar, but tar will also pick up the files
>>which I don't really want.

>
>
> Sun's tar uses a broken archiveformat for ACLs. It does not work
> if the server does not know the names for the uid's.
> Sun's tar also fails to extract files correctly if they don't have
> ACLs but are located inside a directory with default ACLs.
>
> Better use star ftp://ftp.berlios.de/pub/star/alpha/
>
> star -c -Hexustar -acl pat=*/ . > /tmp/archive.tar
>



Can you give me a test case to show this bug in Sun's tar command? I
just ran through the following and it worked just as expected. What did
I do wrong?

$ mkdir test
$ setfacl -m d:u::rwx,d:g::---,d:---,m:rwx
$ touch test/a
$ ls -ld test test/a
drwxr-xr-x+ 2 oracle dba 512 Feb 16 11:18 test/
-rw------- 1 oracle dba 0 Feb 16 11:18 test/a

The directory is ACL'ed, the file is not. Now backup and restore with tar.

$ tar cpvf test.tar test
$ rm -rf test
$ tar xpf test.tar
$ ls -ld test test/a
drwxr-xr-x+ 2 oracle dba 512 Feb 16 11:18 test/
-rw------- 1 oracle dba 0 Feb 16 11:18 test/a

The file named "a" was restored with no ACL's, the directory was
restored with ACL's. I didn't include the getfacl output but it was
exactly what I backed up. I'm using Solaris 8 (SunOS 5.8)
--
To reply by email remove "_nospam"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-06-2008, 08:06 PM
Chuck
 
Posts: n/a
Default Re: Backing up ACL's

Chuck wrote:
> $ mkdir test
> $ setfacl -m d:u::rwx,d:g::---,d:---,m:rwx


type-o. Should say...

$ setfacl -m d:u::rwx,d:g::---,d:---,m:rwx test
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-06-2008, 08:06 PM
Joerg Schilling
 
Posts: n/a
Default Re: Backing up ACL's

In article <37h2urF5d9sajU1@individual.net>,
Chuck <skilover_nospam@softhome.net> wrote:

>> Better use star ftp://ftp.berlios.de/pub/star/alpha/
>>
>> star -c -Hexustar -acl pat=*/ . > /tmp/archive.tar
>>
>>
>>

>
>I think in my case tar will work. All of the users are defined locally,
>and though the directories do have default ACL's, all of the files will
>have ACLs as well. Thanks for the tip though. If I ever get away from
>the current architecture, star may be the way to go.
>
>One thing I don't quite understand is that if ACL's are a posix feature,
>why doesn't the posix archiver pax handle them?


POSIX did try to standardize ACL but stopped when they have been
99% ready.

If POSIX will ever standardize ACLs inside a tar archive, they will
most likely use what star is curently doing.

--
EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
js@cs.tu-berlin.de (uni)
schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
URL: http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:19 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com