tar: Attributes

1 
1 8.2 Handling File Attributes
1 ============================
1 
1 When 'tar' reads files, it updates their access times.  To avoid this,
1 use the '--atime-preserve[=METHOD]' option, which can either reset the
1 access time retroactively or avoid changing it in the first place.
1 
1 '--atime-preserve'
1 '--atime-preserve=replace'
1 '--atime-preserve=system'
1      Preserve the access times of files that are read.  This works only
1      for files that you own, unless you have superuser privileges.
1 
1      '--atime-preserve=replace' works on most systems, but it also
1      restores the data modification time and updates the status change
1      time.  Hence it doesn't interact with incremental dumps nicely
1      (⇒Incremental Dumps), and it can set access or data
1      modification times incorrectly if other programs access the file
1      while 'tar' is running.
1 
1      '--atime-preserve=system' avoids changing the access time in the
1      first place, if the operating system supports this.  Unfortunately,
1      this may or may not work on any given operating system or file
1      system.  If 'tar' knows for sure it won't work, it complains right
1      away.
1 
1      Currently '--atime-preserve' with no operand defaults to
1      '--atime-preserve=replace', but this is intended to change to
1      '--atime-preserve=system' when the latter is better-supported.
1 
1 '-m'
1 '--touch'
1      Do not extract data modification time.
1 
1      When this option is used, 'tar' leaves the data modification times
1      of the files it extracts as the times when the files were
1      extracted, instead of setting it to the times recorded in the
1      archive.
1 
1      This option is meaningless with '--list' ('-t').
1 
1 '--same-owner'
1      Create extracted files with the same ownership they have in the
1      archive.
1 
1      This is the default behavior for the superuser, so this option is
1      meaningful only for non-root users, when 'tar' is executed on those
1      systems able to give files away.  This is considered as a security
1      flaw by many people, at least because it makes quite difficult to
1      correctly account users for the disk space they occupy.  Also, the
1      'suid' or 'sgid' attributes of files are easily and silently lost
1      when files are given away.
1 
1      When writing an archive, 'tar' writes the user ID and user name
1      separately.  If it can't find a user name (because the user ID is
1      not in '/etc/passwd'), then it does not write one.  When restoring,
1      it tries to look the name (if one was written) up in '/etc/passwd'.
1      If it fails, then it uses the user ID stored in the archive
1      instead.
1 
1 '--no-same-owner'
1 '-o'
1      Do not attempt to restore ownership when extracting.  This is the
1      default behavior for ordinary users, so this option has an effect
1      only for the superuser.
1 
1 '--numeric-owner'
1      The '--numeric-owner' option allows (ANSI) archives to be written
1      without user/group name information or such information to be
1      ignored when extracting.  It effectively disables the generation
1      and/or use of user/group name information.  This option forces
1      extraction using the numeric ids from the archive, ignoring the
1      names.
1 
1      This is useful in certain circumstances, when restoring a backup
1      from an emergency floppy with different passwd/group files for
1      example.  It is otherwise impossible to extract files with the
1      right ownerships if the password file in use during the extraction
1      does not match the one belonging to the file system(s) being
1      extracted.  This occurs, for example, if you are restoring your
1      files after a major crash and had booted from an emergency floppy
1      with no password file or put your disk into another machine to do
1      the restore.
1 
1      The numeric ids are _always_ saved into 'tar' archives.  The
1      identifying names are added at create time when provided by the
1      system, unless '--format=oldgnu' is used.  Numeric ids could be
1      used when moving archives between a collection of machines using a
1      centralized management for attribution of numeric ids to users and
1      groups.  This is often made through using the NIS capabilities.
1 
1      When making a 'tar' file for distribution to other sites, it is
1      sometimes cleaner to use a single owner for all files in the
1      distribution, and nicer to specify the write permission bits of the
1      files as stored in the archive independently of their actual value
1      on the file system.  The way to prepare a clean distribution is
1      usually to have some Makefile rule creating a directory, copying
1      all needed files in that directory, then setting ownership and
1      permissions as wanted (there are a lot of possible schemes), and
1      only then making a 'tar' archive out of this directory, before
1      cleaning everything out.  Of course, we could add a lot of options
1      to GNU 'tar' for fine tuning permissions and ownership.  This is
1      not the good way, I think.  GNU 'tar' is already crowded with
1      options and moreover, the approach just explained gives you a great
1      deal of control already.
1 
1 '-p'
1 '--same-permissions'
1 '--preserve-permissions'
1      Extract all protection information.
1 
1      This option causes 'tar' to set the modes (access permissions) of
1      extracted files exactly as recorded in the archive.  If this option
1      is not used, the current 'umask' setting limits the permissions on
1      extracted files.  This option is by default enabled when 'tar' is
1      executed by a superuser.
1 
1      This option is meaningless with '--list' ('-t').
1