chown8
Change file owner and group
Usage
chown [-h]
[-R
[{-H | -L | -P}]]
owner
[:group]
file ...
chown [-h]
[-R
[{-H | -L | -P}]]
:group
file ...
Overview
chown sets the user ID and/or the group ID of the specified files.
The options are as follows:
-
-H -
If the
-Roption is specified, symbolic links on the command line are followed. Symbolic links encountered in the tree traversal are not followed. -
-h -
Treat symbolic links like other files: modify links instead of following them. The
-hand-Roptions are mutually exclusive. -
-L -
If the
-Roption is specified, all symbolic links are followed. -
-P -
If the
-Roption is specified, no symbolic links are followed. -
-R -
Recurse. Where file is a directory, change the user ID and/or the group ID of the directory and all the files and directories in the file hierarchy below it.
The -H, -L, and -P options are ignored unless the -R option is specified; if none of them are given, the default is to not follow symbolic links. In addition, these options override each other and the command's actions are determined by the last one specified.
The owner and group operands are both optional; however, one must be specified. If the group operand is specified, it must be preceded by a colon (‘:’) character.
The owner may be either a numeric user ID or a user name. If a user name is also a numeric user ID, the operand is used as a user name. The group may be either a numeric group ID or a group name. If a group name is also a numeric group ID, the operand is used as a group name.
By default, chown clears the set-user-ID and set-group-ID bits on the file to prevent accidental or mischievous creation of set-user-ID and set-group-ID programs.
Only the superuser is permitted to change the owner of a file.
Exit status
The chown utility exits 0 on success, and >0 if an error occurs.
Releases
61 releases since OpenBSD 2.1; the text changed 19 times.
- 2.1–2.4
- 2.5–2.6
- 2.7
- 2.8
- 2.9–3.3
- 3.4
- 3.5–3.6
- 3.7
- 3.8
- 3.9–4.1
- 4.2–4.4
- 4.5–4.8
- 4.9
- 5.0–5.4
- 5.5–5.8
- 5.9–6.1
- 6.2–6.5
- 6.6–7.5
- 7.6–7.7
- 7.8–8.0
-f until OpenBSD 4.9.