chown - Change file ownership

Synopsis

chown [-R [ -H | -L | -P ]] [ -h ] owner[:group] file ...

Description

You can use chown to set the owner of file to the user identifier or profile specified by owner. Optionally, chown can also set the group of the file to the group identifier or profile specified by group.

To change the owner of a file, you must have one of the following authorities:

To change the group of a file, you must have one of the following authorities:

In addition, the current user must have *USE authority to the new user profile or group profile.

By default, chown follows symbolic links and changes the owner and group of the file pointed to by the symbolic link.

Start of change The group of a file cannot be the same as the owner of the file. End of change

Options

-H
If the -R option is specified, symbolic links on the command line are followed. Symbolic links encountered in the tree traversal are not followed.
-L
If the -R option is specified, both symbolic links on the command line and symbolic links encountered in the tree traversal are followed.
-P
If the -R option is specified, no symbolic links are followed.
-R
If file designates a directory, chown recursively changes the owner and group of each file in the entire subtree connected at that point.
-h
Change the owner and group of a symbolic link instead of the file pointed to by the symbolic link.

Operands

The owner operand specifies either a user identifer number or a user profile name. The group operand specifies either a group identifier number or a group profile name. The file operand specifies a path name to an object.

Exit Status

Related information

Examples
  1. Change the owner to user profile "sam" for the file "personal.file".
    chown sam personal.file
    
  2. Recursively change the owner to user profile "larry" for the sub-directory "moe.dir" and all files and sub-directories below this directory.
    chown -R larry moe.dir
    
  3. Change the owner to user identifier "500" for the file "your.file".
    chown 500 your.file
    
  4. Change the owner to user profile "sam" and the group to group profile "abbey" for the file "memo.txt".
    chown sam:abbey memo.txt