chown - Change the owner or group of a file or directory


chown [-fhR] owner[:group] pathname ...


chown sets the user ID (UID) to owner for the files and directories that are named by pathname arguments. owner can be a user name from the user database, or it can be a numeric user ID. (If a numeric owner exists as a user name in the user database, the user ID number associated with that user name is used.) If there is no change to the UID, then specify - -  -1.

If you include a group name (that is, if you specify owner followed immediately by a colon (:) and then group with no intervening spaces, such as owner:group) chown also sets the group ID (GID) to group for the files and directories named. group can be a group name from the security facility group database, or it can be a numeric group ID. If a numeric group exists as a group name in the group database, the group ID number that is associated with that group is used. If there is no change to the GID, then specify -1 (or do not specify the :group).

Restriction: Only a superuser can change the UID. To change the GID, you must either be a superuser, or the effective user ID of the process must be equal to the user ID of the file owner, and the owner argument is also equal to the user ID of the file owner or -1, and the group argument is the calling process's effective group ID or one of its supplementary group IDs.

chown also turns off the set-user-ID bit and set-group-ID bit of the named files and directories.

For additional information related to chown usage, see the description of the UNIXPRIV class profiles CHOWN.UNRESTRICTED and SUPERUSER.FILESYS.CHOWN in z/OS UNIX System Services Planning.


Does not issue an error message if chown cannot change the owner. In this case, chown always returns a status of zero. Other errors may cause a nonzero return status.
Does not attempt to follow the symbolic link (or external link), but instead makes the changes on the symbolic link (or external link) itself.
If pathname on the command line is the name of a directory, chown changes all the files and subdirectories in that directory to belong to the specified owner (and group, if :group is specified).

If a symbolic link is specified or encountered during the traversal of a file hierarchy, chown changes the directory referenced by the symbolic link and all files in the file hierarchy under it.

If chown cannot change some file or subdirectory in the directory, it continues to try to change the other files and subdirectories in the directory, but exits with a nonzero status.


chown uses the following localization environment variables:
  • LANG
  • LC_ALL

See Localization for more information.

Exit values

You specified -f, or chown successfully changed the ownership of all the specified files and directories.
Failure due to any of the following reasons:
  • Inability to access a specified file.
  • Inability to change the owner of a specified file.
  • Inability to read the directory that contains the directory entry of the file.
  • An unrecoverable error was encountered when using the -R option.
Failure due to any of the following reasons:
  • The command line contained an incorrect option.
  • The command line had too few arguments.
  • An owner was specified with a user ID that the system did not recognize.


function not implemented
This error might occur if the directory is under automount control.


POSIX.2, UNIX systems.

The -f and -h options are an extension of the POSIX standard.

Related information

chgrp, chmod