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

PROLOG

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

NAME

12       chgrp - change the file group ownership
13

SYNOPSIS

15       chgrp [-hR] group file ...
16
17       chgrp -R [-H | -L | -P ] group file ...
18
19

DESCRIPTION

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  IEEE Std 1003.1-2001,
28       called 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

OPTIONS

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

OPERANDS

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

STDIN

98       Not used.
99

INPUT FILES

101       None.
102

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

131       Default.
132

STDOUT

134       Not used.
135

STDERR

137       The standard error shall be used only for diagnostic messages.
138

OUTPUT FILES

140       None.
141

EXTENDED DESCRIPTION

143       None.
144

EXIT STATUS

146       The following exit values shall be returned:
147
148        0     The utility executed successfully and all requested changes were
149              made.
150
151       >0     An error occurred.
152
153

CONSEQUENCES OF ERRORS

155       Default.
156
157       The following sections are informative.
158

APPLICATION USAGE

160       Only  the  owner  of a file or the user with appropriate privileges may
161       change the owner or group of a file.
162
163       Some implementations restrict the use of chgrp to a user with appropri‐
164       ate  privileges  when the group specified is not the effective group ID
165       or one of the supplementary group IDs of the calling process.
166

EXAMPLES

168       None.
169

RATIONALE

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

FUTURE DIRECTIONS

183       None.
184

SEE ALSO

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