xref: /netbsd/sbin/chown/chgrp.1 (revision 6550d01e)
1.\" Copyright (c) 1983, 1990, 1993, 1994, 2003
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. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     from: @(#)chgrp.1	8.3 (Berkeley) 3/31/94
32.\"	$NetBSD: chgrp.1,v 1.4 2011/01/13 22:28:36 haad Exp $
33.\"
34.Dd September 25, 2003
35.Dt CHGRP 1
36.Os
37.Sh NAME
38.Nm chgrp
39.Nd change group
40.Sh SYNOPSIS
41.Nm
42.Oo
43.Fl R
44.Op Fl H | Fl L | Fl P
45.Oc
46.Op Fl fhv
47.Ar group
48.Ar file ...
49.Sh DESCRIPTION
50The
51.Nm
52utility sets the group ID of the file named by each
53.Ar file
54operand to the
55.Ar group
56ID specified by the group operand.
57.Pp
58Options:
59.Bl -tag -width Ds
60.It Fl H
61If the
62.Fl R
63option is specified, symbolic links on the command line are followed.
64(Symbolic links encountered in the tree traversal are not followed.)
65.It Fl L
66If the
67.Fl R
68option is specified, all symbolic links are followed.
69.It Fl P
70If the
71.Fl R
72option is specified, no symbolic links are followed.
73.It Fl R
74Change the group ID for the file hierarchies rooted
75in the files instead of just the files themselves.
76.It Fl f
77The force option ignores errors, except for usage errors and doesn't
78query about strange modes (unless the user does not have proper permissions).
79.It Fl h
80If
81.Ar file
82is a symbolic link, the group of the link is changed.
83.It Fl v
84Cause
85.Nm
86to be verbose, showing files as they are processed.
87.El
88.Pp
89If
90.Fl h
91is not given, unless the
92.Fl H
93or
94.Fl L
95option is set,
96.Nm
97on a symbolic link always succeeds and has no effect.
98The
99.Fl H ,
100.Fl L
101and
102.Fl P
103options are ignored unless the
104.Fl R
105option is specified.
106In addition, these options override each other and the
107command's actions are determined by the last one specified.
108.Pp
109The
110.Ar group
111operand can be either a group name from the group database,
112or a numeric group ID.
113Since it is valid to have a group name that is numeric (and
114doesn't have the numeric ID that matches its name) the name lookup
115is always done first.
116Preceding the ID with a ``#'' character will force it to be taken
117as a number.
118.Pp
119The user invoking
120.Nm
121must belong to the specified group and be the owner of the file,
122or be the super-user.
123.Pp
124Unless invoked by the super-user,
125.Nm
126clears the set-user-id and set-group-id bits on a file to prevent
127accidental or mischievous creation of set-user-id or set-group-id
128programs.
129.Pp
130The
131.Nm
132utility exits 0 on success, and \*[Gt]0 if an error occurs.
133.Sh FILES
134.Bl -tag -width /etc/group -compact
135.It Pa /etc/group
136Group ID file
137.El
138.Sh SEE ALSO
139.Xr chown 2 ,
140.Xr lchown 2 ,
141.Xr fts 3 ,
142.Xr group 5 ,
143.Xr passwd 5 ,
144.Xr symlink 7 ,
145.Xr chown 8
146.Sh STANDARDS
147The
148.Nm
149utility is expected to be POSIX 1003.2 compatible.
150.Pp
151The
152.Fl v
153option and the use of ``#'' to force a numeric group ID
154are extensions to
155.St -p1003.2 .
156