GNU Info

Info Node: ( invocation

( invocation

Next: chgrp invocation Up: Changing file attributes
Enter node , (file) or (file)node

`chown': Change file owner and group

   `chown' changes the user and/or group ownership of each given FILE
to NEW-OWNER or to the user and group of an existing reference file.

     chown [OPTION]... {NEW-OWNER | --reference=REF_FILE} FILE...

   If used, NEW-OWNER specifies the new owner and/or group as follows
(with no embedded white space):

     [OWNER] [ [:] [GROUP] ]


     If only an OWNER (a user name or numeric user id) is given, that
     user is made the owner of each given file, and the files' group is
     not changed.

     If the OWNER is followed by a colon and a GROUP (a group name or
     numeric group id), with no spaces between them, the group
     ownership of the files is changed as well (to GROUP).

     If a colon but no group name follows OWNER, that user is made the
     owner of the files and the group of the files is changed to
     OWNER's login group.

     If the colon and following GROUP are given, but the owner is
     omitted, only the group of the files is changed; in this case,
     `chown' performs the same function as `chgrp'.

   You may use `.' in place of the `:' separator.  This is a GNU
extension for compatibility with older scripts.  New scripts should
avoid the use of `.' because GNU `chown' may fail if OWNER contains `.'

   The program accepts the following options.  Also see Note: Common

     Verbosely describe the action for each FILE whose ownership
     actually changes.

     Do not print error messages about files whose ownership cannot be

     Change a FILE's ownership only if it has current attributes
     specified by OLD-OWNER.  OLD-OWNER has the same form as NEW-OWNER
     described above.  This option is useful primarily from a security
     standpoint in that it narrows considerably the window of potential
     abuse.  For example, to reflect a UID numbering change for one
     user's files without an option like this, `root' might run

          find / -owner OLDUSER -print0 | xargs -0 chown NEWUSER

     But that is dangerous because the interval between when the `find'
     tests the existing file's owner and when the `chown' is actually
     run may be quite large.  One way to narrow the gap would be to
     invoke chown for each file as it is found:

          find / -owner OLDUSER -exec chown NEWUSER {} \;

     But that is very slow if there are many affected files.  With this
     option, it is safer (the gap is narrower still) though still not

          chown -R --from=OLDUSER NEWUSER /

     Do not act on symbolic links themselves but rather on what they
     point to.

     Act on symbolic links themselves instead of what they point to.
     This is the default.  This mode relies on the `lchown' system call.
     On systems that do not provide the `lchown' system call, `chown'
     fails when a file specified on the command line is a symbolic link.
     By default, no diagnostic is issued for symbolic links encountered
     during a recursive traversal, but see `--verbose'.

     Change the user and group of each FILE to be the same as those of
     REF_FILE.  If REF_FILE is a symbolic link, do not use the user and
     group of the symbolic link, but rather those of the file it refers

     Output a diagnostic for every file processed.  If a symbolic link
     is encountered during a recursive traversal on a system without
     the `lchown' system call, and `--no-dereference' is in effect,
     then issue a diagnostic saying neither the symbolic link nor its
     referent is being changed.

     Recursively change ownership of directories and their contents.

automatically generated by info2www version