1CHGRP(P)                   POSIX Programmer's Manual                  CHGRP(P)
2
3
4

NAME

6       chgrp - change the file group ownership
7

SYNOPSIS

9       chgrp [-hR] group file ...
10
11       chgrp -R [-H | -L | -P ] group file ...
12
13

DESCRIPTION

15       The chgrp utility shall set the group ID of the file named by each file
16       operand to the group ID specified by the group operand.
17
18       For each file operand, or, if the -R option is used, each file  encoun‐
19       tered while walking the directory trees specified by the file operands,
20       the chgrp utility shall perform actions equivalent to the chown() func‐
21       tion  defined  in the System Interfaces volume of IEEE Std 1003.1-2001,
22       called with the following arguments:
23
24        * The file operand shall be used as the path argument.
25
26        * The user ID of the file shall be used as the owner argument.
27
28        * The specified group ID shall be used as the group argument.
29
30       Unless chgrp is invoked by a process with appropriate  privileges,  the
31       set-user-ID  and  set-group-ID  bits of a regular file shall be cleared
32       upon successful completion; the set-user-ID and  set-group-ID  bits  of
33       other file types may be cleared.
34

OPTIONS

36       The  chgrp  utility  shall  conform  to  the Base Definitions volume of
37       IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
38
39       The following options shall be supported by the implementation:
40
41       -h     If the system supports group IDs for symbolic  links,  for  each
42              file  operand  that  names  a  file of type symbolic link, chgrp
43              shall attempt to set the group ID of the symbolic  link  instead
44              of  the file referenced by the symbolic link. If the system does
45              not support group IDs for symbolic links, for each file  operand
46              that  names a file of type symbolic link, chgrp shall do nothing
47              more with the current file and shall  go  on  to  any  remaining
48              files.
49
50       -H     If  the -R option is specified and a symbolic link referencing a
51              file of type directory is specified on the command  line,  chgrp
52              shall  change  the group of the directory referenced by the sym‐
53              bolic link and all files in the file hierarchy below it.
54
55       -L     If the -R option is specified and a symbolic link referencing  a
56              file  of  type  directory  is  specified  on the command line or
57              encountered during the traversal  of  a  file  hierarchy,  chgrp
58              shall  change  the group of the directory referenced by the sym‐
59              bolic link and all files in the file hierarchy below it.
60
61       -P     If the -R option is specified and a symbolic link  is  specified
62              on  the  command  line  or encountered during the traversal of a
63              file hierarchy, chgrp shall change the group ID of the  symbolic
64              link  if  the  system supports this operation. The chgrp utility
65              shall not follow the symbolic link to any other part of the file
66              hierarchy.
67
68       -R     Recursively  change  file  group IDs. For each file operand that
69              names a directory, chgrp shall change the group of the directory
70              and  all  files in the file hierarchy below it. Unless a -H, -L,
71              or -P option is specified, it  is  unspecified  which  of  these
72              options will be used as the default.
73
74
75       Specifying  more than one of the mutually-exclusive options -H, -L, and
76       -P shall not be considered an error.  The last option  specified  shall
77       determine the behavior of the utility.
78

OPERANDS

80       The following operands shall be supported:
81
82       group  A  group  name  from  the  group database or a numeric group ID.
83              Either specifies a group ID to be given to each  file  named  by
84              one  of  the file operands. If a numeric group operand exists in
85              the group database as a group name, the group ID number  associ‐
86              ated with that group name is used as the group ID.
87
88       file   A pathname of a file whose group ID is to be modified.
89
90

STDIN

92       Not used.
93

INPUT FILES

95       None.
96

ENVIRONMENT VARIABLES

98       The  following  environment  variables  shall  affect  the execution of
99       chgrp:
100
101       LANG   Provide a default value for the  internationalization  variables
102              that  are  unset  or  null.  (See the Base Definitions volume of
103              IEEE Std 1003.1-2001, Section  8.2,  Internationalization  Vari‐
104              ables  for the precedence of internationalization variables used
105              to determine the values of locale categories.)
106
107       LC_ALL If set to a non-empty string value, override the values  of  all
108              the other internationalization variables.
109
110       LC_CTYPE
111              Determine  the  locale  for  the  interpretation of sequences of
112              bytes of text data as characters (for  example,  single-byte  as
113              opposed to multi-byte characters in arguments).
114
115       LC_MESSAGES
116              Determine  the  locale  that should be used to affect the format
117              and contents of diagnostic messages written to standard error.
118
119       NLSPATH
120              Determine the location of message catalogs for the processing of
121              LC_MESSAGES .
122
123

ASYNCHRONOUS EVENTS

125       Default.
126

STDOUT

128       Not used.
129

STDERR

131       The standard error shall be used only for diagnostic messages.
132

OUTPUT FILES

134       None.
135

EXTENDED DESCRIPTION

137       None.
138

EXIT STATUS

140       The following exit values shall be returned:
141
142        0     The utility executed successfully and all requested changes were
143              made.
144
145       >0     An error occurred.
146
147

CONSEQUENCES OF ERRORS

149       Default.
150
151       The following sections are informative.
152

APPLICATION USAGE

154       Only the owner of a file or the user with  appropriate  privileges  may
155       change the owner or group of a file.
156
157       Some implementations restrict the use of chgrp to a user with appropri‐
158       ate privileges when the group specified is not the effective  group  ID
159       or one of the supplementary group IDs of the calling process.
160

EXAMPLES

162       None.
163

RATIONALE

165       The  System  V  and  BSD versions use different exit status codes. Some
166       implementations used the exit status as a count of the number of errors
167       that  occurred;  this  practice is unworkable since it can overflow the
168       range of valid exit status values. The  standard  developers  chose  to
169       mask these by specifying only 0 and >0 as exit values.
170
171       The  functionality  of  chgrp is described substantially through refer‐
172       ences to chown(). In this  way,  there  is  no  duplication  of  effort
173       required  for  describing  the  interactions  of  permissions, multiple
174       groups, and so on.
175

FUTURE DIRECTIONS

177       None.
178

SEE ALSO

180       chmod()   ,   chown()   ,   the    System    Interfaces    volume    of
181       IEEE Std 1003.1-2001, chown()
182
184       Portions  of  this text are reprinted and reproduced in electronic form
185       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
186       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
187       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
188       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
189       event of any discrepancy between this version and the original IEEE and
190       The  Open Group Standard, the original IEEE and The Open Group Standard
191       is the referee document. The original Standard can be  obtained  online
192       at http://www.opengroup.org/unix/online.html .
193
194
195
196IEEE/The Open Group                  2003                             CHGRP(P)
Impressum