xref: /openbsd-src/bin/chmod/chgrp.1 (revision 20b6c1a110d3b888f9bad4e11966882019c4cfd5)
1*20b6c1a1Sjmc.\"	$OpenBSD: chgrp.1,v 1.19 2024/08/01 14:08:38 jmc Exp $
2b358c706Smickey.\"
3b358c706Smickey.\" Copyright (c) 1983, 1990, 1993, 1994
4b358c706Smickey.\"	The Regents of the University of California.  All rights reserved.
5b358c706Smickey.\"
6b358c706Smickey.\" This code is derived from software contributed to Berkeley by
7b358c706Smickey.\" the Institute of Electrical and Electronics Engineers, Inc.
8b358c706Smickey.\"
9b358c706Smickey.\" Redistribution and use in source and binary forms, with or without
10b358c706Smickey.\" modification, are permitted provided that the following conditions
11b358c706Smickey.\" are met:
12b358c706Smickey.\" 1. Redistributions of source code must retain the above copyright
13b358c706Smickey.\"    notice, this list of conditions and the following disclaimer.
14b358c706Smickey.\" 2. Redistributions in binary form must reproduce the above copyright
15b358c706Smickey.\"    notice, this list of conditions and the following disclaimer in the
16b358c706Smickey.\"    documentation and/or other materials provided with the distribution.
1729295d1cSmillert.\" 3. Neither the name of the University nor the names of its contributors
18b358c706Smickey.\"    may be used to endorse or promote products derived from this software
19b358c706Smickey.\"    without specific prior written permission.
20b358c706Smickey.\"
21b358c706Smickey.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22b358c706Smickey.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23b358c706Smickey.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24b358c706Smickey.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25b358c706Smickey.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26b358c706Smickey.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27b358c706Smickey.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28b358c706Smickey.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29b358c706Smickey.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30b358c706Smickey.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31b358c706Smickey.\" SUCH DAMAGE.
32b358c706Smickey.\"
33b358c706Smickey.\"     from: @(#)chgrp.1	8.3 (Berkeley) 3/31/94
34b358c706Smickey.\"
35*20b6c1a1Sjmc.Dd $Mdocdate: August 1 2024 $
36b358c706Smickey.Dt CHGRP 1
37b358c706Smickey.Os
38b358c706Smickey.Sh NAME
39b358c706Smickey.Nm chgrp
40b358c706Smickey.Nd change group
41b358c706Smickey.Sh SYNOPSIS
42b358c706Smickey.Nm chgrp
4369e2e443Sokan.Op Fl h
44b358c706Smickey.Oo
45b358c706Smickey.Fl R
46461c7c1eSjmc.Op Fl H | L | P
47b358c706Smickey.Oc
48b358c706Smickey.Ar group
4933b7713aSjmc.Ar
50b358c706Smickey.Sh DESCRIPTION
51b358c706Smickey.Nm
52b358c706Smickeysets the group ID of the specified files.
53b358c706Smickey.Pp
54b358c706SmickeyThe options are as follows:
55b358c706Smickey.Bl -tag -width Ds
56b358c706Smickey.It Fl H
57b358c706SmickeyIf the
58b358c706Smickey.Fl R
59b358c706Smickeyoption is specified, symbolic links on the command line are followed.
60ef05aa49SjmcSymbolic links encountered in the tree traversal are not followed.
6171bfe0a1Sjmc.It Fl h
62251a4e53SguentherTreat symbolic links like other files: modify links instead of
63251a4e53Sguentherfollowing them.
6471bfe0a1SjmcThe
6571bfe0a1Sjmc.Fl h
6671bfe0a1Sjmcand
6771bfe0a1Sjmc.Fl R
6871bfe0a1Sjmcoptions are mutually exclusive.
69b358c706Smickey.It Fl L
70b358c706SmickeyIf the
71b358c706Smickey.Fl R
72b358c706Smickeyoption is specified, all symbolic links are followed.
73b358c706Smickey.It Fl P
74b358c706SmickeyIf the
75b358c706Smickey.Fl R
76b358c706Smickeyoption is specified, no symbolic links are followed.
77b358c706Smickey.It Fl R
78ef05aa49SjmcRecurse.
79ef05aa49SjmcWhere
80ef05aa49Sjmc.Ar file
81ef05aa49Sjmcis a directory,
82ef05aa49Sjmcchange the group ID of the directory and all the files and directories
83ef05aa49Sjmcin the file hierarchy below it.
84b358c706Smickey.El
85b358c706Smickey.Pp
86b358c706SmickeyThe
87b358c706Smickey.Fl H ,
881fd45b44Saaron.Fl L ,
89b358c706Smickeyand
90b358c706Smickey.Fl P
91b358c706Smickeyoptions are ignored unless the
92b358c706Smickey.Fl R
93ef05aa49Sjmcoption is specified;
94ef05aa49Sjmcif none of them are given,
95ef05aa49Sjmcthe default is to not follow symbolic links.
96b358c706SmickeyIn addition, these options override each other and the
97b358c706Smickeycommand's actions are determined by the last one specified.
98b358c706Smickey.Pp
99b358c706SmickeyThe
100b358c706Smickey.Ar group
101b358c706Smickeyoperand can be either a group name from the group database,
102b358c706Smickeyor a numeric group ID.
103b358c706SmickeyIf a group name is also a numeric group ID, the operand is used as a
104b358c706Smickeygroup name.
105b358c706Smickey.Pp
10620c27302SjmcBy default,
10720c27302Sjmc.Nm
10820c27302Sjmcclears the set-user-ID and set-group-ID bits on the file
10920c27302Sjmcto prevent accidental or mischievous creation of
11020c27302Sjmcset-user-ID and set-group-ID programs.
11120c27302SjmcThis behaviour can be overridden by setting the
11220c27302Sjmc.Xr sysctl 8
11320c27302Sjmcvariable
11420c27302Sjmc.Va fs.posix.setuid
11520c27302Sjmcto zero.
11620c27302Sjmc.Pp
117b358c706SmickeyThe user invoking
118c849c109Saaron.Nm
119b358c706Smickeymust belong to the specified group and be the owner of the file,
120b358c706Smickeyor be the superuser.
121b358c706Smickey.Sh FILES
122b358c706Smickey.Bl -tag -width /etc/group -compact
123b358c706Smickey.It Pa /etc/group
124b358c706Smickeygroup ID file
125b358c706Smickey.El
12659a5f2b9Sjmc.Sh EXIT STATUS
12759a5f2b9Sjmc.Ex -std chgrp
128b358c706Smickey.Sh SEE ALSO
129b358c706Smickey.Xr chown 2 ,
130647427d6Sderaadt.Xr fts_open 3 ,
131b358c706Smickey.Xr group 5 ,
132b358c706Smickey.Xr passwd 5 ,
133b358c706Smickey.Xr symlink 7 ,
134b358c706Smickey.Xr chown 8
135b358c706Smickey.Sh STANDARDS
136b358c706SmickeyThe
137c849c109Saaron.Nm
1380f3f4dbcSjmcutility is compliant with the
139*20b6c1a1Sjmc.St -p1003.1-2024
1400f3f4dbcSjmcspecification.
141