Re: a subtle(?) tar extraction permission problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17:34 25 Jun 2004, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:
|   say i have a directory structure a/b/c/{f1,f2,f3,...}.  for access 
| reasons, i decide to change the permissions on the "c" directory, 
| perhaps changing the owner/group, and definitely changing the perms to 
| include "setgid".
|   later, i get a tarball with contents a/b/c/{something}.  i found out 
| that if i extract that tarball while root, and the effect is to add or 
| delete files under the "c" directory, the permissions on "c" revert 
| back to default values.  how annoying.

I think you'll find the tarball also has "a/b/c" in it too.

|   apparently, as long as what i'm extracting is already in that 
| directory (so that the directory entries themselves don't change), i'm 
| safe.  but if the extraction changes the directory contents 
| themselves, i get the owner/group/perms resetting on "c", which i'd
| *really* like to avoid.
| 
|   i've perused the tar options, and i don't see anything that says, 
| "don't mess with existing options on existing directories."  is there 
| a standard approach to handle this?

1: Don't extract as root?
2: Note perms, extract, fix perms.
3: Extract only the files - avoid the directories.
   A tar file has entries for the dirs, which is of course where the perms are.
   Don't as for them:

	tar xvf tarfile a/b/c/f1 a/b/c/f2 ...
   
   You could do this algorithmicly by doing a table of contents,
   sucking out the filenames, then doing the extract.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Gauls!  We have nothing to fear; except perhaps that the sky may fall
on our heads tomorrow.  But as we all know, tomorrow never comes!!
        - Adventures of Asterix



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux