Need help preserving permissions when using tar?
Guy Harris
guy at sun.uucp
Wed Jul 17 18:10:25 AEST 1985
> The tar in 4.2bsd (and maybe other Berkeley releases) puts directory
> permissions into the tar file and creates the directories with those
> permissions when you read the tar file.
It only creates the directories with those permissions if you use the "p"
flag when reading the tape in. (It creates files with the permissions from
the tape under all circumstances, but it proceeds to change the mode of the
file from the mode it was created with to the very same mode if you specify
the "p" flag! To add a bit of confusion, the System V Release 2 "tar" has
an "o" flag - conflicting, alas, with the Berkeley "o" flag which tells it
*not* to put directories on the tape - which tells it not to change the
owner and group owner of the files to the values from the tape. I guess
this wasn't in V7 because only the super-user can change the ownership of a
file. The only reason I can assume for why it wasn't changed in the first
USG release it was on is that none of the people using USG releases use
"tar" - they use "cpio" instead. Having all files read in from a "tar" (or
"cpio"!) file from another site owned by whatever random users have the same
numeric user ID as the owner of the file at that site gets old *real*
quickly...
Guy Harris
More information about the Comp.unix.wizards
mailing list