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