file_cmds-45.tar.gz
[apple/file_cmds.git] / chown / chgrp.1
1 .\" Copyright (c) 1983, 1990, 1993, 1994
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the Institute of Electrical and Electronics Engineers, Inc.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\"    must display the following acknowledgement:
17 .\"     This product includes software developed by the University of
18 .\"     California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\"    may be used to endorse or promote products derived from this software
21 .\"    without specific prior written permission.
22 .\"
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" SUCH DAMAGE.
34 .\"
35 .\"     from: @(#)chgrp.1       8.3 (Berkeley) 3/31/94
36 .\"     $NetBSD: chgrp.1,v 1.10 1997/12/21 18:11:19 kleink Exp $
37 .\"
38 .Dd March 31, 1994
39 .Dt CHGRP 1
40 .Os BSD 4.2
41 .Sh NAME
42 .Nm chgrp
43 .Nd change group
44 .Sh SYNOPSIS
45 .Nm
46 .Oo
47 .Fl R
48 .Op Fl H | Fl L | Fl P
49 .Oc
50 .Op Fl fh
51 .Ar group
52 .Ar files ...
53 .Sh DESCRIPTION
54 The
55 .Nm
56 utility sets the group ID of the file named by each
57 .Ar file
58 operand to the
59 .Ar group
60 ID specified by the group operand.
61 .Pp
62 Options:
63 .Bl -tag -width Ds
64 .It Fl H
65 If the
66 .Fl R
67 option is specified, symbolic links on the command line are followed.
68 (Symbolic links encountered in the tree traversal are not followed.)
69 .It Fl L
70 If the
71 .Fl R
72 option is specified, all symbolic links are followed.
73 .It Fl P
74 If the
75 .Fl R
76 option is specified, no symbolic links are followed.
77 .It Fl R
78 Change the group ID for the file hierarchies rooted
79 in the files instead of just the files themselves.
80 .It Fl f
81 The force option ignores errors, except for usage errors and doesn't
82 query about strange modes (unless the user does not have proper permissions).
83 .It Fl h
84 If
85 .Ar file
86 is a symbolic link, the group of the link is changed.
87 .El
88 .Pp
89 If
90 .Fl h
91 is not given, unless the 
92 .Fl H
93 or
94 .Fl L
95 option is set,
96 .Nm
97 on a symbolic link always succeeds and has no effect.
98 The
99 .Fl H ,
100 .Fl L
101 and
102 .Fl P
103 options are ignored unless the
104 .Fl R
105 option is specified.
106 In addition, these options override each other and the
107 command's actions are determined by the last one specified.
108 .Pp
109 The
110 .Ar group
111 operand can be either a group name from the group database,
112 or a numeric group ID.
113 If a group name is also a numeric group ID, the operand is used as a
114 group name.
115 .Pp
116 The user invoking
117 .Nm
118 must belong to the specified group and be the owner of the file,
119 or be the super-user.
120 .Pp
121 Unless invoked by the super-user,
122 .Nm
123 clears the set-user-id and set-group-id bits on a file to prevent
124 accidental or mischievous creation of set-user-id or set-group-id
125 programs.
126 .Pp
127 The
128 .Nm
129 utility exits 0 on success, and >0 if an error occurs.
130 .Sh FILES
131 .Bl -tag -width /etc/group -compact
132 .It Pa /etc/group
133 Group ID file
134 .El
135 .Sh SEE ALSO
136 .Xr chown 2 ,
137 .Xr lchown 2 ,
138 .Xr fts 3 ,
139 .Xr group 5 ,
140 .Xr passwd 5 ,
141 .Xr symlink 7 ,
142 .Xr chown 8
143 .Sh STANDARDS
144 The
145 .Nm
146 utility is expected to be POSIX 1003.2 compatible.