That's what an archiving program is supposed to do.
That's a feature, not a bug. It's an archive after all.
It's even a tape archiving tool. Just pretty much nobody uses it in the original way any more.
Very much one of those "if it ain't broke, don't replace it" tools.
I just assumed that whenever it would be expanded that the contents would have the default permissions for that user.
It's actually a cool feature I just feel dumb for how long it took me to realize this was the issue.
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).
Just bear in mind that uid 1001 on one machine is not generally uid 1001 on another, and that if you copy the tar off machine you're more than likely giving permission to somebody other than the intended target
Linux
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0