1chgrp(1)                         User Commands                        chgrp(1)
2
3
4

NAME

6       chgrp - change file group ownership
7

SYNOPSIS

9       chgrp [-fhR] group file...
10
11
12       chgrp -s [-fhR] groupsid file...
13
14
15       chgrp -R [f] [-H | -L | -P] group file...
16
17
18       chgrp -s -R [f] [-H | -L | -P] groupsid file...
19
20

DESCRIPTION

22       The  chgrp utility will set the group ID of the file named by each file
23       operand to the group ID specified by the group operand.
24
25
26       For each file operand,  it  will  perform  actions  equivalent  to  the
27       chown(2) function, called with the following arguments:
28
29           o      The file operand will be used as the path argument.
30
31           o      The user ID of the file will be used as the owner argument.
32
33           o      The specified group ID will be used as the group argument.
34
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  will  be  cleared
38       upon  successful  completion;  the set-user-ID and set-group-ID bits of
39       other file types may be cleared.
40
41
42       The     operating     system     has     a     configuration     option
43       _POSIX_CHOWN_RESTRICTED,  to  restrict  ownership  changes.  When  this
44       option is in effect, the owner of the file may change the group of  the
45       file  only  to  a group to which the owner belongs. Only the super-user
46       can arbitrarily change owner IDs, whether or  not  this  option  is  in
47       effect. To set this configuration option, include the following line in
48       /etc/system:
49
50         set rstchown = 1
51
52
53
54       To disable this option, include the following line in /etc/system:
55
56         set rstchown = 0
57
58
59
60       _POSIX_CHOWN_RESTRICTED is enabled by default. See system(4) and fpath‐
61       conf(2).
62

OPTIONS

64       The following options are supported.
65
66   /usr/bin/chgrp and /usr/xpg4/bin/chgrp
67       -f    Force. Does not report errors.
68
69
70       -h    If  the file is a symbolic link, this option changes the group of
71             the symbolic link. Without this option, the  group  of  the  file
72             referenced by the symbolic link is changed.
73
74
75       -H    If the file specified on the command line is a symbolic link ref‐
76             erencing a file of type directory, this option changes the  group
77             of  the  directory  referenced  by  the symbolic link and all the
78             files in the file hierarchy below  it.  If  a  symbolic  link  is
79             encountered  when  traversing  a file hierarchy, the group of the
80             target file is changed, but no recursion takes place.
81
82
83       -L    If the file is a symbolic link, this option changes the group  of
84             the  file  referenced by the symbolic link. If the file specified
85             on the command line, or encountered during the traversal  of  the
86             file  hierarchy,  is  a  symbolic link referencing a file of type
87             directory, then this option changes the group  of  the  directory
88             referenced by the symbolic link and all files in the file hierar‐
89             chy below it.
90
91
92       -P    If the file specified on the command line or  encountered  during
93             the traversal of a file hierarchy is a symbolic link, this option
94             changes the group of the symbolic link. This option does not fol‐
95             low the symbolic link to any other part of the file hierarchy.
96
97
98       -s    The  specified  group is Windows SID. This option requires a file
99             system that supports storing SIDs, such as ZFS.
100
101
102
103       Specifying more than one of the mutually-exclusive options -H,  -L,  or
104       -P is not considered an error. The last option specified determines the
105       behavior of chgrp.
106
107   /usr/bin/chgrp
108       -R    Recursive. chgrp descends through the directory, and  any  subdi‐
109             rectories,  setting the specified group ID as it proceeds. When a
110             symbolic link is encountered, the group of  the  target  file  is
111             changed,  unless  the  -h  or -P option is specified. However, no
112             recursion takes place, unless the -H or -L option is specified.
113
114
115   /usr/xpg4/bin/chgrp
116       -R    Recursive. chgrp descends through the directory, and  any  subdi‐
117             rectories,  setting the specified group ID as it proceeds. When a
118             symbolic link is encountered, the group of  the  target  file  is
119             changed,  unless the -h or -P option is specified. Unless the -H,
120             -L, or -P option is specified, the  -L  option  is  used  as  the
121             default mode.
122
123

OPERANDS

125       The following operands are supported:
126
127       group    A  group  name  from the group database or a numeric group ID.
128                Either specifies a group ID to be given to each file named  by
129                one of the file operands. If a numeric group operand exists in
130                the group database as a group name, the group ID number  asso‐
131                ciated with that group name is used as the group ID.
132
133
134       file     A path name of a file whose group ID is to be modified.
135
136

USAGE

138       See  largefile(5)  for  the  description  of the behavior of chgrp when
139       encountering files greater than or equal to 2 Gbyte (2^31 bytes).
140

ENVIRONMENT VARIABLES

142       See environ(5) for descriptions of the following environment  variables
143       that  affect  the  execution  of chgrp: LANG, LC_ALL, LC_CTYPE, LC_MES‐
144       SAGES, and NLSPATH.
145

EXIT STATUS

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

FILES

157       /etc/group    group file
158
159

ATTRIBUTES

161       See attributes(5) for descriptions of the following attributes:
162
163   /usr/bin/chgrp
164       ┌─────────────────────────────┬─────────────────────────────┐
165       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
166       ├─────────────────────────────┼─────────────────────────────┤
167       │Availability                 │SUNWcsu                      │
168       ├─────────────────────────────┼─────────────────────────────┤
169       │CSI                          │Enabled. See NOTES.          │
170       ├─────────────────────────────┼─────────────────────────────┤
171       │Interface Stability          │Committed                    │
172       ├─────────────────────────────┼─────────────────────────────┤
173       │Standard                     │See standards(5).            │
174       └─────────────────────────────┴─────────────────────────────┘
175
176   /usr/xpg4/bin/chgrp
177       ┌─────────────────────────────┬─────────────────────────────┐
178       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
179       ├─────────────────────────────┼─────────────────────────────┤
180       │Availability                 │SUNWxcu4                     │
181       ├─────────────────────────────┼─────────────────────────────┤
182       │CSI                          │Enabled. See NOTES.          │
183       ├─────────────────────────────┼─────────────────────────────┤
184       │Interface Stability          │Committed                    │
185       ├─────────────────────────────┼─────────────────────────────┤
186       │Standard                     │See standards(5).            │
187       └─────────────────────────────┴─────────────────────────────┘
188

SEE ALSO

190       chmod(1),   chown(1),   id(1M),   chown(2),   fpathconf(2),   group(4),
191       passwd(4), system(4), attributes(5),  environ(5),  largefile(5),  stan‐
192       dards(5)
193

NOTES

195       chgrp is CSI-enabled except for the group name.
196
197
198
199SunOS 5.11                        11 Jul 2008                         chgrp(1)
Impressum