chgrp(1) chgrp(1)
NAME
chgrp - change the group ownership of a file (change group)
SYNOPSIS
chgrp [-R] [-h] [--] newgroup file ...
DESCRIPTION
chgrp changes the user group for a file or a directory. You can only
use it if you are the file/directory owner or the system administra-
tor.
The system administrator has an unrestricted right to change the user
group for any file.
There is an operating system configuration option RSTCHOWN which can
be used to place a restriction on the groups to which users without
system administrator privileges can reassign their files. If this
option is in effect, as an ordinary user you can assign your files to
another group only if you are listed in the /etc/group file as a
member of the new group (see FILES).
If chgrp is called by a user without system administrator privileges,
any set-user-ID and set-group-ID bits [see chmod(1)] set for the
specified files are cleared.
OPTIONS
-R (recursive) chgrp recursively descends through the specified
directories, changing the group ID as it proceeds and traversing
any symbolic links that it encounters.
-h If file is a symbolic link, chgrp changes the group ID of the
symbolic link itself. Without this option, the group ID of the
file referenced by the symbolic link is changed.
-- If newgroup begins with a dash (-), the end of the command-line
options must be marked with --.
newgroup
New group name or new group ID. newgroup must appear in
/etc/group.
file Name of the file or directory for which the user group is to be
redefined. You can also list any number of files and/or direc-
tories.
ERROR MESSAGES
file: Not owner
You are not permitted to change the user group of the specified file,
since you are not the owner of the file or have not been entered as a
member of the specified group or do not currently belong to the group.
Page 1 Reliant UNIX 5.44 Printed 11/98
chgrp(1) chgrp(1)
Only the system administrator is authorized to redefine the group for
all files.
chgrp: unknown group: newgroup
The group name you have specified for newgroup is not in the
/etc/group file.
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
EXAMPLES
You are currently working under the login name cindy; this name is
entered in the /etc/group file as a member of the user groups ag and
prog. At present, you belong to the user group ag as is evident from
the fact that the name ag is entered for "group" when you create new
files.
$ >file
$ ls -l file
-rw------- 1 cindy ag 0 Feb 17 15:48 file
You now wish to change the user group for file; the new group is to be
prog. To do this, you first use the newgrp command to switch to the
prog group and then change the group for file with chgrp.
$ newgrp prog
$ chgrp prog file
$ ls -l file
-rw------- 1 cindy prog 0 Feb 17 15:48 file
FILES
/etc/group
The group file /etc/group contains a list of all existing user
groups. Each line of this file consists of four colon-separated
fields: groupname:[password]:groupid:user,user ...
Only the system administrator is permitted to create new user
groups and to enter new group members.
SEE ALSO
chmod(1), chown(1), id(1), newgrp(1), chown(2), defaultpasswd(4),
group(4), passwd(4).
Page 2 Reliant UNIX 5.44 Printed 11/98