hi all,

so im running a simple tar command to tar a dir but that dir the user:group is owned by the user “bitwarden” and im tar’ing it under the user root but it works as i imagine root can do it even when it doesnt own it

thanks,
rob

2 Spice ups

You have posted a statement, not a question; is there something you want to know about tar?

1 Spice up

What do you need help with, Robert?

just want to know if im right or wrong

By default, tar stores the user and group numeric IDs, if you extract files as root, those numeric IDs are preserved, if you extract as a regular user, the extracted files take on the ID of the user doing the extraction, so yes, you are correct.

One of the issues with tar files from another system is that the user and group IDs may not be the same, a tar file made on a RedHat machine may extract to the wrong user and group on a Suse machine.

You can override the IDs preserved within the tar archive at creation or extraction time, but it becomes less of a simple tar command.

so even if i kick off the tar under logged in user root even if the folder is owned by bitwarden it will still tar it successfully, i know i will need to chmod and chown it

Why should you want to chmod and chown?