I have a tarball. This tarball contains—of course—various files and directories. When I extract the tar, some of these files already exist, while others don't.
What I would like to know is this: how can I extract a tarball to keep the metadata of already existing files intact (ownership, group, read, write, execute etc.), regardless who executes the command and what was the original directory layout upon tar creation?
So far what I have found are these:
--mode='555' --owner=owner --group=group
When I use these flags when creating the tarball, it actually does change the metadata of all the files in the tar accordingly. However I don't know how could I change it for a small set of files which should have other permissions.
As I understand this flag is used when extracting the tarball and should keep the metadata of already existing files, but I don't get the expected results.