NAME
chown — change the
file ownership
SYNOPSIS
chown |
[-R]
owner[:group]
file ... |
DESCRIPTION
The chown utility will set the user ID of
the file named by each file operand to the user ID specified by the owner
operand.
For each file operand, it will perform actions equivalent to the XSH specification chown() function, called with the following arguments:
- The file operand will be used as the path argument.
- The user ID indicated by the owner portion of the first operand will be used as the owner argument.
- If the group portion of the first operand is given, the group ID indicated by it will be used as the group argument; otherwise, the group ID of the file will be used as the group argument.
Unless chown is invoked by a process with
appropriate privileges, the set-user-ID and set-group-ID bits of a regular
file will be cleared upon successful completion; the set-user-ID and
set-group-ID bits of other file types may be cleared.
OPTIONS
The chown utility supports the XBD
specification,
Utility
Syntax Guidelines .
The following option is supported:
- -R
- Recursively change file user IDs, and if the group operand is specified,
group IDs. For each file operand that names a directory,
chownchanges the user and group ID of the directory and all files in the file hierarchy below it.
OPERANDS
The following operands are supported:
- owner[:group]
- A user ID and optional group ID to be assigned to file . The owner portion of this operand must be a user name from the user database or a numeric user ID. Either specifies a user ID to be given to each file named by one of the file operands. If a numeric owner operand exists in the user database as a user name, the user ID number associated with that user name will be used as the user ID. Similarly, if the group portion of this operand is present, it must be a group name from the group database or a numeric group ID. Either specifies a group ID to be given to each file. If a numeric group operand exists in the group database as a group name, the group ID number associated with that group name will be used as the group ID.
- file
- A pathname of a file whose user ID is to be modified.
STDIN
Not used.
INPUT FILES
None.
ENVIRONMENT VARIABLES
The following environment variables affect the execution of
chown :
LANG- Provide a default value for the internationalisation variables that are
unset or null. If
LANGis unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined. LC_ALL- If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES- Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH- Determine the location of message catalogues for the processing of LC_MESSAGES .
ASYNCHRONOUS EVENTS
Default.
STDOUT
Not used.
STDERR
Used only for diagnostic messages.
OUTPUT FILES
None.
EXTENDED DESCRIPTION
None.
EXIT STATUS
The following exit values are returned:
CONSEQUENCES OF ERRORS
If, when invoked with the -R option,
chown attempts but fails to change the user ID or,
if the group operand is specified, group ID, of a particular file in a
specified file hierarchy, it will continue to process the remaining files in
the hierarchy.
If chown cannot read or search a directory
within a hierarchy, it will continue to process the other parts of the
hierarchy that are accessible.
APPLICATION USAGE
Only the owner of a file or the user with appropriate privileges may change the owner or group of a file.
Some systems restrict the use of chown to
a user with appropriate privileges.
EXAMPLES
None.
FUTURE DIRECTIONS
None.
SEE ALSO
chmod(1) , chgrp(1) , the XSH specification description of chown(3) .