sudo tar changes extracted files ownership to unknown user
When extracting files as root, tar will use the original ownership. You can override that using the --no-same-owner
option (alternatively, -o
).
Your tar file referred to user/group which do not exist on the system where you extracted it.
If you extract files as yourself (a non-privileged user), you can only create files owned by yourself.
The GNU tar manual says:
--same-owner
When extracting an archive, tar will attempt to preserve the owner specified in the tar archive with this option present. This is the default behavior for the superuser; this option has an effect only for ordinary users. See section Handling File Attributes.