CHGRP(1) General Commands Manual CHGRP(1)

chgrpchange file group ownership

chgrp [-R] group file ...

The chgrp utility shall set the group ID of the file named by each file operand to the group ID specified by the group operand. For each file operand, it shall perform actions equivalent to the POSIX. 1 {8} chown(3) function, called with the following arguments:

  1. The file operand shall be used as the path argument.
  2. The user ID of the file shall be used as the owner argument.
  3. The specified group ID shall be used as the group argument.

The chgrp utility shall conform to the utility argument syntax guidelines described in 2.10.2. The following option shall be supported by the implementation:

Recursively change file group IDs. For each file operand that names a directory, chgrp shall change the group of the directory and all files in the file hierarchy below it.

The following operands shall be supported by the implementation:

group

A group name from the group database or a numeric group ID. Either specifies a group ID to be given to each file named by one of the file operands. If a numeric group operand exists in the group database as a group name, the group ID number associated with that group name is used as the group ID.

file

A pathname of a file whose group ID is to be modified.

None.

None.

The following environment variables shall affect the execution of chgrp:

This variable shall determine the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (beginning with LC_ ) do not specify a locale. See 2.6.

This variable shall determine the locale to be used to override any values for locale categories specified by the settings of LANG or any environment variables beginning with LC_.

This variable shall determine the locale for the interpretation of sequences of bytes of text data as characters (e.g., single- versus multibyte characters in arguments).

This variable shall determine the language in which messages should be written.

Default.

None.

Used only for diagnostic messages.

None.

None.

The chgrp utility shall exit with one of the following values:

The utility executed successfully and all requested changes were made.

An error occurred.

If, when invoked with the −R option, chgrp attempts but fails to change the group ID of a particular file in a specified file hierarchy, it shall continue to process the remaining files in the hierarchy. If chgrp cannot read or search a directory within a hierarchy, it shall continue to process the other parts of the hierarchy that are accessible.

The System V and versions use different exit status codes. Some implementations used the exit status as a count of the number of errors that occurred; this practice is unworkable since it can overflow the range of valid exit status value. The working group chose to mask these by specifying only 0 and >0 as exit values.

The functionality of chgrp is described substantially through references to functions in POSIX. 1 {8}. In this way, there is no duplication of effort required for describing the interactions of permissions, multiple groups, etc.

September 1991 posix.fail