Tarfile and usernames

Hans Mulder hansmu at xs4all.nl
Sun Dec 30 22:24:04 CET 2012


On 30/12/12 19:57:31, Nicholas Cole wrote:
> Dear List,
> 
> I'm hoping to use the tarfile module in the standard library to move
> some files between computers. 
> 
> I can't see documented anywhere what this library does with userids and
> groupids.  I can't guarantee that the computers involved will have the
> same users and groups, and would like the archives to be extracted so
> that the files are all owned by the extracting user. 
> 
> Essentially, I do *not* with to preserve the owner and groups specified
> in the archives.
> 
> What is the right way to achieve this?

I would agree that this ought to be documented.

>From reading the code: the way to achieve this, is to run as a user
other than root. Or monkeypatch the TarFile.chown method to be a no-op.


Hope this helps,

-- HansM



More information about the Python-list mailing list