Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (7229 KB)
chown(1)Name | Synopsis | Description | Options | Operands | Usage | Examples | Environment Variables | Exit Status | Files | Attributes | See Also | Notes Name
Synopsis/usr/bin/chown [-fhR] owner[:group] file... /usr/bin/chown -s [-fhR] ownersid[:groupsid] file... /usr/bin/chown -R [-f] [-H | -L | -P] owner[:group] file... /usr/bin/chown -s -R [-f] [-H | -L | -P] ownersid[:groupsid] file... /usr/xpg4/bin/chown/usr/xpg4/bin/chown [-fhR] owner[:group] file... /usr/xpg4/bin/chown -s [-fhR] ownersid[:groupsid] file... /usr/xpg4/bin/chown -R [-f] [-H | -L | -P] owner[:group] file... /usr/xpg4/bin/chown -s -R [-f] [-H | -L | -P] ownersid[:groupsid] file... ksh93chown [-cflhmnvHLPRX] [-r file] owner[:group] file... Description/usr/bin/chown and /usr/xpg4/bin/chownThe chown utility sets the user ID of the file named by each file to the user ID specified by owner, and, optionally, sets the group ID to that specified by group. If chown is invoked by other than the super-user, the set-user-ID bit is cleared. Only the owner of a file (or the super-user) can change the owner of that file. The operating system has a configuration option {_POSIX_CHOWN_RESTRICTED}, to restrict ownership changes. When this option is in effect the owner of the file is prevented from changing the owner ID of the file. Only the super-user can arbitrarily change owner IDs whether or not this option is in effect. To set this configuration option, include the following line in /etc/system:
To disable this option, include the following line in /etc/system:
{_POSIX_CHOWN_RESTRICTED} is enabled by default. See system(4) and fpathconf(2). ksh93The chown built-in in ksh93 is associated with the /bin and /usr/bin paths. It is invoked when chown is executed without a pathname prefix and the pathname search finds a /bin/chown or /usr/bin/chown executable. chown changes the ownership of each file to owner. owner can be specified as either a user name or a numeric user id. The group ownership of each file can also be changed to group by appending :group to the user name. Options
/usr/bin/chown and /usr/xpg4/bin/chownThe following options are supported: Specifying more than one of the mutually-exclusive options -H, -L, or -P is not considered an error. The last option specified determines the behavior of chown. /usr/bin/chownThe following options are supported: /usr/xpg4/bin/chownThe following options are supported: ksh93The following options are supported by the ksh93 built-in chown command: Operands
The following operands are supported: UsageSee largefile(5) for the description of the behavior of chown when encountering files greater than or equal to 2 Gbyte ( 231 bytes). ExamplesExample 1 Changing Ownership of All Files in the HierarchyThe following command changes ownership of all files in the hierarchy, including symbolic links, but not the targets of the links:
Environment VariablesSee environ(5) for descriptions of the following environment variables that affect the execution of chown: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. Exit Status
The following exit values are returned: FilesAttributesSee attributes(5) for descriptions of the following attributes: /usr/bin/chown
/usr/xpg4/bin/chown
ksh93See Alsochgrp(1), chmod(1),ksh93(1), chown(2), fpathconf(2), passwd(4), system(4), attributes(5), environ(5), largefile(5), standards(5) Noteschown is CSI-enabled except for the owner and group names. Name | Synopsis | Description | Options | Operands | Usage | Examples | Environment Variables | Exit Status | Files | Attributes | See Also | Notes |
||||||||||||||||||||||||