Linux/tar

From Omnia
Revision as of 00:24, 29 June 2018 by Kenneth (talk | contribs) (Created page with "== Don't Preserver Owner == Problem: <blockquote> I'd like to compress some files for http distribution, but found that .tar.gz keeps the user name and user ID and there does...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Don't Preserver Owner

Problem:

I'd like to compress some files for http distribution, but found that .tar.gz keeps the user name and user ID and there doesn't seem to be any way to not do that? (There is a --numeric-owner option for tar which seems to ignore the user name, but still keeps the user ID.)

Doesn't that mean that .tar.gz is a poor choice for file distribution as my system probably is the only one with my user ID and my user name? Is .7z a better format for file distribution, or do you have any other recommendation?

Solution:

Generally .tar.gz is a usable file distribution format. GNU tar allows you to replace owner, group and permissions with other values when adding files to the archive.

tar -c -f archive.tar --owner=0 --group=0 .

Ref: tar without preserving user - Unix & Linux Stack Exchange - https://unix.stackexchange.com/questions/285237/tar-without-preserving-user