root+tar's '--same-owner --preserve' options

Robert Connolly robert at
Sun Mar 9 14:31:11 PDT 2008

On Sunday March 9 2008 04:28:57 pm marty wrote:
> >>  This patch adds --disable-default-root-preserve to Tar, so root will
> >> not preserve file modes or ownership by default. The --same-owner and
> >> --preserve options still work. Root's umask is used by default.
> Does that mean that when I tar up /var/log or /var/spool all of the
> existing permissions will end up going down the tubes unless I specify
> otherwise? Really bad idea methinks. Tar is a backup program and preserving
> existing file modes and permissions is an essential component. Why mess
> with perfection?
> You can safely achieve the same results with a wrapper script called
> "untar" which would pass the arguments and desired flags to tar. I think...
> Marty B.

The patch is on extract.c. It comments out the check done to see if geteuid is 
root, which automatically enables the options to preserve permissions when 
extracting files. Everything else works normally. How tarballs are created is 

I don't like the current behavior because it silently makes a backdoor, with 
the user to blame for not using the right Tar options. The preserve 
permission options are usefull, but not 90% of the time, so I think they 
should be disabled by default.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the hlfs-dev mailing list