Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
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 '13 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... –  Baard Kopperud Apr 8 '13 at 11:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.