Quantcast
Channel: How to create a .tar.gz file owned by a specific owner and group? - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2

How to create a .tar.gz file owned by a specific owner and group?

$
0
0

I want to create a tar.gz file of a directory which will be owned by a certain user and group (and not by root, who is creating the archive).

Basically, I want to combine the following to one single step:

tar -cvz -f temp-backup.tar.gz temp/chown absonegative:absonegative temp-backup.tar.gz

Is that possible in one single pass? I want to avoid that there is a (albeit very small) period in which the file exists as root:root, as my current backup solution has problems with that (I am trying to fix that as well).

Note that I want to retain the ownership of the files inside the archive, as is already covered if you execute tar as root. I only want to alter the ownership of the result.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images