1CHGRP(1P) POSIX Programmer's Manual CHGRP(1P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 chgrp — change the file group ownership
14
16 chgrp [−h] group file...
17
18 chgrp −R [−H|−L|−P] group file...
19
21 The chgrp utility shall set the group ID of the file named by each file
22 operand to the group ID specified by the group operand.
23
24 For each file operand, or, if the −R option is used, each file encoun‐
25 tered while walking the directory trees specified by the file operands,
26 the chgrp utility shall perform actions equivalent to the chown() func‐
27 tion defined in the System Interfaces volume of POSIX.1‐2008, called
28 with the following arguments:
29
30 * The file operand shall be used as the path argument.
31
32 * The user ID of the file shall be used as the owner argument.
33
34 * The specified group ID shall be used as the group argument.
35
36 Unless chgrp is invoked by a process with appropriate privileges, the
37 set-user-ID and set-group-ID bits of a regular file shall be cleared
38 upon successful completion; the set-user-ID and set-group-ID bits of
39 other file types may be cleared.
40
42 The chgrp utility shall conform to the Base Definitions volume of
43 POSIX.1‐2008, Section 12.2, Utility Syntax Guidelines.
44
45 The following options shall be supported by the implementation:
46
47 −h For each file operand that names a file of type symbolic
48 link, chgrp shall attempt to set the group ID of the symbolic
49 link instead of the file referenced by the symbolic link.
50
51 −H If the −R option is specified and a symbolic link referencing
52 a file of type directory is specified on the command line,
53 chgrp shall change the group of the directory referenced by
54 the symbolic link and all files in the file hierarchy below
55 it.
56
57 −L If the −R option is specified and a symbolic link referencing
58 a file of type directory is specified on the command line or
59 encountered during the traversal of a file hierarchy, chgrp
60 shall change the group of the directory referenced by the
61 symbolic link and all files in the file hierarchy below it.
62
63 −P If the −R option is specified and a symbolic link is speci‐
64 fied on the command line or encountered during the traversal
65 of a file hierarchy, chgrp shall change the group ID of the
66 symbolic link. The chgrp utility shall not follow the sym‐
67 bolic link to any other part of the file hierarchy.
68
69 −R Recursively change file group IDs. For each file operand that
70 names a directory, chgrp shall change the group of the direc‐
71 tory and all files in the file hierarchy below it. Unless a
72 −H, −L, or −P option is specified, it is unspecified which of
73 these options will be used as the default.
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
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
85 in the group database as a group name, the group ID number
86 associated 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
91 Not used.
92
94 None.
95
97 The following environment variables shall affect the execution of
98 chgrp:
99
100 LANG Provide a default value for the internationalization vari‐
101 ables that are unset or null. (See the Base Definitions vol‐
102 ume of POSIX.1‐2008, Section 8.2, Internationalization Vari‐
103 ables for the precedence of internationalization variables
104 used to determine the values of locale categories.)
105
106 LC_ALL If set to a non-empty string value, override the values of
107 all the other internationalization variables.
108
109 LC_CTYPE Determine the locale for the interpretation of sequences of
110 bytes of text data as characters (for example, single-byte as
111 opposed to multi-byte characters in arguments).
112
113 LC_MESSAGES
114 Determine the locale that should be used to affect the format
115 and contents of diagnostic messages written to standard
116 error.
117
118 NLSPATH Determine the location of message catalogs for the processing
119 of LC_MESSAGES.
120
122 Default.
123
125 Not used.
126
128 The standard error shall be used only for diagnostic messages.
129
131 None.
132
134 None.
135
137 The following exit values shall be returned:
138
139 0 The utility executed successfully and all requested changes were
140 made.
141
142 >0 An error occurred.
143
145 Default.
146
147 The following sections are informative.
148
150 Only the owner of a file or the user with appropriate privileges may
151 change the owner or group of a file.
152
153 Some implementations restrict the use of chgrp to a user with appropri‐
154 ate privileges when the group specified is not the effective group ID
155 or one of the supplementary group IDs of the calling process.
156
158 None.
159
161 The System V and BSD versions use different exit status codes. Some
162 implementations used the exit status as a count of the number of errors
163 that occurred; this practice is unworkable since it can overflow the
164 range of valid exit status values. The standard developers chose to
165 mask these by specifying only 0 and >0 as exit values.
166
167 The functionality of chgrp is described substantially through refer‐
168 ences to chown(). In this way, there is no duplication of effort
169 required for describing the interactions of permissions, multiple
170 groups, and so on.
171
173 None.
174
176 chmod, chown
177
178 The Base Definitions volume of POSIX.1‐2008, Chapter 8, Environment
179 Variables, Section 12.2, Utility Syntax Guidelines
180
181 The System Interfaces volume of POSIX.1‐2008, chown()
182
184 Portions of this text are reprinted and reproduced in electronic form
185 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
186 -- Portable Operating System Interface (POSIX), The Open Group Base
187 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
188 cal and Electronics Engineers, Inc and The Open Group. (This is
189 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
190 event of any discrepancy between this version and the original IEEE and
191 The Open Group Standard, the original IEEE and The Open Group Standard
192 is the referee document. The original Standard can be obtained online
193 at http://www.unix.org/online.html .
194
195 Any typographical or formatting errors that appear in this page are
196 most likely to have been introduced during the conversion of the source
197 files to man page format. To report such errors, see https://www.ker‐
198 nel.org/doc/man-pages/reporting_bugs.html .
199
200
201
202IEEE/The Open Group 2013 CHGRP(1P)