xref: /openbsd/bin/chmod/chgrp.1 (revision 91f110e0)
1.\"	$OpenBSD: chgrp.1,v 1.16 2014/01/21 22:35:44 jmc Exp $
2.\"
3.\" Copyright (c) 1983, 1990, 1993, 1994
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" This code is derived from software contributed to Berkeley by
7.\" the Institute of Electrical and Electronics Engineers, Inc.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. Neither the name of the University nor the names of its contributors
18.\"    may be used to endorse or promote products derived from this software
19.\"    without specific prior written permission.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.\"     from: @(#)chgrp.1	8.3 (Berkeley) 3/31/94
34.\"
35.Dd $Mdocdate: January 21 2014 $
36.Dt CHGRP 1
37.Os
38.Sh NAME
39.Nm chgrp
40.Nd change group
41.Sh SYNOPSIS
42.Nm chgrp
43.Op Fl h
44.Oo
45.Fl R
46.Op Fl H | L | P
47.Oc
48.Ar group
49.Ar
50.Sh DESCRIPTION
51.Nm
52sets the group ID of the specified files.
53.Pp
54The options are as follows:
55.Bl -tag -width Ds
56.It Fl H
57If the
58.Fl R
59option is specified, symbolic links on the command line are followed.
60Symbolic links encountered in the tree traversal are not followed.
61.It Fl h
62Change the group ID of the specified symbolic link.
63The
64.Fl h
65and
66.Fl R
67options are mutually exclusive.
68.It Fl L
69If the
70.Fl R
71option is specified, all symbolic links are followed.
72.It Fl P
73If the
74.Fl R
75option is specified, no symbolic links are followed.
76.It Fl R
77Recurse.
78Where
79.Ar file
80is a directory,
81change the group ID of the directory and all the files and directories
82in the file hierarchy below it.
83.El
84.Pp
85The
86.Fl H ,
87.Fl L ,
88and
89.Fl P
90options are ignored unless the
91.Fl R
92option is specified;
93if none of them are given,
94the default is to not follow symbolic links.
95In addition, these options override each other and the
96command's actions are determined by the last one specified.
97.Pp
98The
99.Ar group
100operand can be either a group name from the group database,
101or a numeric group ID.
102If a group name is also a numeric group ID, the operand is used as a
103group name.
104.Pp
105By default,
106.Nm
107clears the set-user-ID and set-group-ID bits on the file
108to prevent accidental or mischievous creation of
109set-user-ID and set-group-ID programs.
110This behaviour can be overridden by setting the
111.Xr sysctl 8
112variable
113.Va fs.posix.setuid
114to zero.
115.Pp
116The user invoking
117.Nm
118must belong to the specified group and be the owner of the file,
119or be the superuser.
120.Sh FILES
121.Bl -tag -width /etc/group -compact
122.It Pa /etc/group
123group ID file
124.El
125.Sh EXIT STATUS
126.Ex -std chgrp
127.Sh SEE ALSO
128.Xr chown 2 ,
129.Xr fts 3 ,
130.Xr group 5 ,
131.Xr passwd 5 ,
132.Xr symlink 7 ,
133.Xr chown 8
134.Sh STANDARDS
135The
136.Nm
137utility is compliant with the
138.St -p1003.1-2008
139specification.
140