xref: /freebsd/usr.sbin/chown/chgrp.1 (revision 4f8f43b06ed07e96a250855488cc531799d5b78f)
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. 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.\"     @(#)chgrp.1	8.3 (Berkeley) 3/31/94
32.\"
33.Dd January 7, 2017
34.Dt CHGRP 1
35.Os
36.Sh NAME
37.Nm chgrp
38.Nd change group
39.Sh SYNOPSIS
40.Nm
41.Op Fl fhvx
42.Oo
43.Fl R
44.Op Fl H | Fl L | Fl P
45.Oc
46.Ar group
47.Ar
48.Sh DESCRIPTION
49The
50.Nm
51utility sets the group ID of the file named by each
52.Ar file
53operand to the
54.Ar group
55ID specified by the group operand.
56.Pp
57The following options are available:
58.Bl -tag -width indent
59.It Fl H
60If the
61.Fl R
62option is specified, symbolic links on the command line are followed
63and hence unaffected by the command.
64(Symbolic links encountered during 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.
73This is the default.
74.It Fl R
75Change the group ID of the file hierarchies rooted in the files,
76instead of just the files themselves.
77Beware of unintentionally matching the
78.Dq Pa ".."
79hard link to the parent directory when using wildcards like
80.Dq Li ".*" .
81.It Fl f
82The force option ignores errors, except for usage errors and does not
83query about strange modes (unless the user does not have proper permissions).
84.It Fl h
85If the file is a symbolic link, the group ID of the link itself is changed
86rather than the file that is pointed to.
87.It Fl v
88Cause
89.Nm
90to be verbose, showing files as the group is modified.
91If the
92.Fl v
93flag is specified more than once,
94.Nm
95will print the filename, followed by the old and new numeric group ID.
96.It Fl x
97File system mount points are not traversed.
98.El
99.Pp
100The
101.Fl H ,
102.Fl L
103and
104.Fl P
105options are ignored unless the
106.Fl R
107option is specified.
108In addition, these options override each other and the
109command's actions are determined by the last one specified.
110.Pp
111The
112.Ar group
113operand can be either a group name from the group database,
114or a numeric group ID.
115If a group name is also a numeric group ID, the operand is used as a
116group name.
117.Pp
118The user invoking
119.Nm
120must belong to the specified group and be the owner of the file,
121or be the super-user.
122.Pp
123If
124.Nm
125receives a
126.Dv SIGINFO
127signal (see the
128.Cm status
129argument for
130.Xr stty 1 ) ,
131then the current filename as well as the old and new group names are
132displayed.
133.Sh FILES
134.Bl -tag -width /etc/group -compact
135.It Pa /etc/group
136group ID file
137.El
138.Sh EXIT STATUS
139.Ex -std
140.Sh COMPATIBILITY
141In previous versions of this system, symbolic links did not have groups.
142.Pp
143The
144.Fl v
145and
146.Fl x
147options are non-standard and their use in scripts is not recommended.
148.Sh SEE ALSO
149.Xr chown 2 ,
150.Xr fts 3 ,
151.Xr group 5 ,
152.Xr passwd 5 ,
153.Xr symlink 7 ,
154.Xr chown 8
155.Sh STANDARDS
156The
157.Nm
158utility is expected to be
159.St -p1003.2
160compatible.
161