Since no one has yet mentioned, by default if you’re running tar as a non-root user it extracts files with owner/umask of the current user and if you run it as root (or superuser) it’ll preserve ownership and permissions. From tar man page:
–no-same-owner
Extract files as yourself (default for ordinary users).
–no-same-permissions
Apply the user’s umask when extracting permissions from the archive (default for ordinary users).
As mentioned, with root the defaults are to keep UID/permissions as they are in the archive. (–preserve-permissions and --same-owner).
Since no one has yet mentioned, by default if you’re running tar as a non-root user it extracts files with owner/umask of the current user and if you run it as root (or superuser) it’ll preserve ownership and permissions. From tar man page:
As mentioned, with root the defaults are to keep UID/permissions as they are in the archive. (–preserve-permissions and --same-owner).
Really good callout! Thanks for adding that