3

In tar's man page I stumbled upon two options:

  • --numeric-owner: always use numbers for user/group names
  • --owner=NAME: force NAME as owner for added files

This made me wonder: When I tar a few files/folders (e.g. with tar cf photos.tar photos/) and publish the archive online, can my user/group name be extracted from it?

1 Answer 1

4

Yes. The user and group - along with permissions and various timestamps - is stored in the tar-archive by default. Remember the idea is that you can restore the content as it was, with the correct user/group.

You can try by looking at a tar archive:

$ cat something.tar | less

You'll see a user-and group-name in the "block" with the filename and other information prior to each file's content. This is not just the UID and GID number (needing to be decoded with the passwd and group files), but the actual name-strings.

2
  • Better use something more robust in front of binary data, like od -c. Besides, less might have been set up to do something funky with tarfiles...
    – vonbrand
    Apr 8, 2013 at 11:18
  • That's why I used cat and not less directly (less something.tar), to avoid the funkyness. Though I agree that looking at binary-files with less can be rather... Apr 8, 2013 at 11:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .