Guys,

When restoring files from a streamed archived (i.e. via the option -f -), it 
appears the parent subdirectories are restored with the user's ownership and 
umasked permissions (subject to any use of --no-overwrite-dir).  I'm using the 
latest tar, i.e. 1.28:

bnetst03:/usr/local/sbin/des_setup/svc # /usr/local/bin/tar --version
tar (GNU tar) 1.28
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
bnetst03:/usr/local/sbin/des_setup/svc #


For example, we have the following directory:

bnetst03:/tmp # ls -l -d /etc /etc/opt /etc/opt/wbem
dr-xr-xr-x  40 root       sys           8192 Sep 25 14:12 /etc
dr-xr-xr-x  25 bin        bin           8192 Mar 13  2014 /etc/opt
drwxr-xr-x   2 cimsrvr    bin           8192 Sep 25 12:37 /etc/opt/wbem
bnetst03:/tmp # ls -l /etc/opt/wbem
total 48
-rw-r--r--   1 bin        bin            150 Dec  1  2010 cimserver_retry.conf
-rw-------   1 cimsrvr    cimsrvr         12 Sep 25 12:37 cimserver_start.conf
-r-xr--r--   1 bin        bin            759 Dec  1  2010 providerVersion
bnetst03:/tmp #


Tar-ing this small directory into an archive ...

bnetst03:/ # /usr/local/tar cvf /tmp/t /etc/opt/wbem
etc/opt/wbem/
etc/opt/wbem/cimserver_retry.conf
etc/opt/wbem/providerVersion
etc/opt/wbem/cimserver_start.conf
bnetst03:/ #


We see that, upon restoring a particular member of wbem/ from the archive 
presented through stdin, that member is restored with its correct metadata but 
its parent subdirectories are restored with the ownership of the session user 
and permissions as per its umask:

bnetst03:/tmp # cat /tmp/t | /usr/local/bin/tar xvf - 
etc/opt/wbem/cimserver_start.conf
etc/opt/wbem/cimserver_start.conf
bnetst03:/tmp # ls -l -d etc etc/opt etc/opt/wbem
drwx------   3 root       sys             96 Sep 25 14:37 etc
drwx------   3 root       sys             96 Sep 25 14:37 etc/opt
drwx------   2 root       sys             96 Sep 25 14:37 etc/opt/wbem
bnetst03:/tmp # ls -l etc/opt/wbem
total 16
-rw-------   1 cimsrvr    cimsrvr         12 Sep 25 12:37 cimserver_start.conf
bnetst03:/tmp #


If the entire archive is extracted, only the immediate parent subdirectory has 
its correct metadata, the others still appear with session user ownership and 
permissions:

bnetst03:/tmp # ls -l -d etc
drwx------   3 root       sys             96 Sep 25 14:47 etc
bnetst03:/tmp # ll -R etc
total 0
drwx------   3 root       sys             96 Sep 25 14:47 opt

etc/opt:
total 16
drwxr-xr-x   2 cimsrvr    bin           8192 Sep 25 12:37 wbem

etc/opt/wbem:
total 48
-rw-r--r--   1 bin        bin            150 Dec  1  2010 cimserver_retry.conf
-rw-------   1 cimsrvr    cimsrvr         12 Sep 25 12:37 cimserver_start.conf
-r-xr--r--   1 bin        bin            759 Dec  1  2010 providerVersion
bnetst03:/tmp #




Rocket J. Squirrel: "... we're going to have to think!"
Bullwinkle J. Moose: "There must be an easier way than that."
HOWARD BRYDEN

Senior Unix Administrator
Infrastructure Support
Public Safety Business Agency

PHONE: 07 3635 3087
POSTAL: GPO Box 1425, Brisbane, QLD 4001 | EMAIL: 
howard.bry...@dcs.qld.gov.au<mailto:howard.bry...@dcs.qld.gov.au>

[cid:image001.jpg@01CF9486.DD35C1D0]     [cid:image003.jpg@01CF8FBC.3E77B590]
Great state.  Great opportunity.


This correspondence is for the named persons only. It may contain confidential 
or privileged information or both. No confidentiality or privilege is waived or 
lost by any mis transmission. If you receive this correspondence in error 
please delete it from your system immediately and notify the sender. You must 
not disclose, copy or relay on any part of this correspondence, if you are not 
the intended recipient. Any opinions expressed in this message are those of the 
individual sender except where the sender expressly, and with the authority, 
states them to be the opinions of the Queensland Government.

All reasonable precautions will be taken to respect the privacy of individuals 
in accordance with the Information Privacy Act 2009 (Qld).

Reply via email to