Need help preserving permissions when using tar?

Guy Harris guy at sun.uucp
Mon Jul 22 09:02:07 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.
> 
> But it only sets ownerships if the user who extracts is root.

That's because the "chown" system call is privileged in V7 and 4.xBSD and
"tar" doesn't run set-UID "root".  Be grateful; the "tar" in System III will
set ownerships under any circumstances because the "chown" system call isn't
privileged.  This is lousy because you may have gotten a "tar" tape from
another site, and you really don't want the files owned by whatever random
person has the same user ID as the person who owned the files on the
original machine.  The System V "tar" has a "o" flag (which, alas, conflicts
with the 4.xBSD "tar"s "o" flag, which tells it not to put directory
information on the tape) that tells it not to change the ownership of files.

	Guy Harris



More information about the Comp.unix.wizards mailing list