[CentOS] Tar of files

Wed Mar 3 15:02:27 UTC 2021
Valeri Galtsev <galtsev at kicp.uchicago.edu>

On 3/3/21 8:53 AM, Jerry Geis wrote:
> When I "tar" up an archive the files have an owner bob,
> when I extract that to another machine bob is there also but user number is
> different.

If you pack and extract as root, then numeric UID will be the same. But 
on different systems there may be different usernames that have that 
numeric UID.

Incidentally: sometimes we enable SGID bit on a directory (to have 
everything that is created in it inherit the group that directory 
belongs to). tar will be one of the tools that will break it: extracted 
archive will have group as it was in the archived original (numeric GID 
that is, if both archiving and un-archiving was performed by root).

I hope, this helps.


> So when I extract bob is no longer the owner of the files but someone else.
> Is there a good way to account for this ?
> User ID on one box being different to the next box ?
> I was expecting to untar and bob still be the owner .
> Thanks,
> Jerry
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos

Valeri Galtsev
Sr System Administrator
Department of Astronomy and Astrophysics
Kavli Institute for Cosmological Physics
University of Chicago
Phone: 773-702-4247