chown(C)


chown -- change owner ID

Syntax

chown [ -R ] owner[:group] file ...

Description

The chown command changes the owner ID of each file to the user ID specified by owner. The owner may be either a decimal user ID or a login name found in the file /etc/passwd.

If a group ID is given, then chown also changes the group ID of the files to the group ID specified by group. The group may be either a decimal group ID or a group name found in the file /etc/group.

chown takes the following option:


-R
Recursively change file user IDs, and if group is specified, group IDs. For each file that names a directory, chown changes the owner and group ID of the directory and all files in the hierarchy below it.

Exit values

chown returns the following values:

0
the command executed successfully, and all requested changes were made

>0
an error occurred

Examples

To give away ownership of file /tmp/myfile to user gavin:

chown gavin /tmp/myfile

To give away ownership of /tmp/mydir and all files within it to user gavin:

chown -R gavin /tmp/mydir

Limitations

When used to change the ownership of a symbolic link, chown automatically follows the link and tries to change the ownership of the linked file. It makes no sense for symbolic links to have their own permissions and ownerships.

Authorization

Use of this utility is governed by the chown kernel privilege. Restricted chown is required for NIST FIPS 151-1 conformance.

If you have chown kernel privilege, you can change the owner and group of files that you initially own. If you do not have chown privilege, you cannot change the ownership of files; you can change their group, but only if the files are initially owned by you, and the new group is your effective group ID or is listed in your supplemental group list.

Files


/etc/passwd

/etc/group

See also

chgrp(C), chown(S), group(F), passwd(F)

Standards conformance

chown is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
NIST FIPS 151-2;
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.

Notices

A version of chown that can handle files greater than 2GB is available in /u95/bin. See chown(1) for more information.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005