chown(1) chown(1)
NAME
chown - change file owner
SYNOPSIS
chown [-R] [-h] [--] newowner[:newgroup] file ...
DESCRIPTION
chown assigns a new owner and, where necessary, a new group to a file
or a directory. The group is only changed if newgroup is specified
explicitly.
The system administrator has an unrestricted right to change the owner
of any file.
By contrast, normal users without system administrator privileges may
only change the owner ID of their own files. If the operating system
option RSTCHOWN is in effect, even the owner of a file is prevented
from changing the ownership of that file. In such a case, an error
message chown: file: Not owner (see ERROR MESSAGES) is displayed.
If chown is invoked by a user other than the system administrator, the
set-user-ID bit of the file mode, 4000, is cleared.
OPTIONS
-R (recursive) chown recursively descends through the specified
directories, changing the file owner as it proceeds and travers-
ing any symbolic links that it encounters.
-h If file is a symbolic link, chown changes the owner of the sym-
bolic link. Without this option, the owner of the file referenced
by the symbolic link is changed.
-- If newowner begins with a dash (-), the end of the command-line
options must be marked with --.
newowner
Login name or user ID of the new owner. Must be one that is
entered in the /etc/passwd file.
newgroup
New group name or new group number. newgroup must be entered in
the /etc/group file.
file Name of the file that is to have a new owner. Directories and
multiple file names are also allowed.
Page 1 Reliant UNIX 5.44 Printed 11/98
chown(1) chown(1)
ERROR MESSAGES
chown: file: Not owner
You are not permitted to change the owner of the named file, as you
are not working as the system administrator or the RSTCHOWN variable
is set on your system.
chown: unknown user id newowner
The login name you specified for newowner is not entered in the
/etc/passwd file.
LOCALE
The LCMESSAGES environment variable governs the language in which mes-
sage texts are displayed. If LCMESSAGES is undefined or is defined as
the null string, it defaults to the value of LANG. If LANG is likewise
undefined or null, the system acts as if it were not internationalized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
EXAMPLES
As system administrator you want to change the owner of a file; the
owner of the file text1, currently user cathy, is to be changed to
mark, while the owner of the file text2 is to be changed to fred. To
do this, you enter:
# ls -l text1 text2
-rw------- 1 cathy ag 2426 Feb 17 15:48 text1
-rw------- 1 cathy ag 1587 Feb 17 15:49 text2
# chown mark text1
# ls -l text1
-rw------- 1 mark ag 2426 Feb 17 15:48 text1
# chown fred:usrother text2
# ls -l text2
-rw------- 1 fred usrother 1587 Feb 17 15:49 text2
EXIT STATUS
0 The utility executed successfully and all requested changes were
made.
>0 An error occurred.
Page 2 Reliant UNIX 5.44 Printed 11/98
chown(1) chown(1)
FILES
/etc/passwd
The /etc/passwd file contains information on all existing users.
Only the system administrator is allowed to add new users.
/etc/group
The /etc/group file contains all user groups created.
Only the system administrator can create new user groups and
enter new group members.
SEE ALSO
chgrp(1), chmod(1), chown(2), passwd(4).
Page 3 Reliant UNIX 5.44 Printed 11/98