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.10 2023/05/20 09:41:34 pgoyette Exp $ 33.\" 34.Dd May 19, 2023 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 dfhv 47.Ar group 48.Ar 49.Nm 50.Oo 51.Fl R 52.Op Fl H | Fl L | Fl P 53.Oc 54.Op Fl dfhv 55.Fl Fl reference=rfile 56.Ar 57.Sh DESCRIPTION 58The 59.Nm 60utility sets the group ID of the file named by each 61.Ar file 62operand to the 63.Ar group 64ID specified by the group operand, 65or to the group of the given 66.Ar rfile , 67specified by the 68.Fl Fl reference 69argument. 70.Pp 71Options: 72.Bl -tag -width Ds 73.It Fl H 74If the 75.Fl R 76option is specified, symbolic links on the command line are followed. 77(Symbolic links encountered in the tree traversal are not followed.) 78.It Fl L 79If the 80.Fl R 81option is specified, all symbolic links are followed. 82.It Fl P 83If the 84.Fl R 85option is specified, no symbolic links are followed. 86.It Fl R 87Change the group ID for the file hierarchies rooted 88in the files instead of just the files themselves. 89.It Fl d 90Do not attempt to update a file's group, nor update the file's 91set-user-id or set-group-id bits if they are already set to the 92desired values. 93.It Fl f 94The force option ignores errors, except for usage errors and doesn't 95query about strange modes (unless the user does not have proper permissions). 96.It Fl h 97If 98.Ar file 99is a symbolic link, the group of the link is changed. 100.It Fl v 101Cause 102.Nm 103to be verbose, showing files as they are processed. 104.El 105.Pp 106If 107.Fl h 108is not given, unless the 109.Fl H 110or 111.Fl L 112option is set, 113.Nm 114on a symbolic link always succeeds and has no effect. 115The 116.Fl H , 117.Fl L 118and 119.Fl P 120options are ignored unless the 121.Fl R 122option is specified. 123In addition, these options override each other and the 124command's actions are determined by the last one specified. 125The default is as if the 126.Fl P 127option had been specified. 128.Pp 129The 130.Ar group 131operand can be either a group name from the group database, 132or a numeric group ID. 133Since it is valid to have a group name that is numeric (and 134doesn't have the numeric ID that matches its name) the name lookup 135is always done first. 136Preceding the ID with a ``#'' character will force it to be taken 137as a number. 138.Pp 139The user invoking 140.Nm 141must belong to the specified group and be the owner of the file, 142or be the super-user. 143.Pp 144Unless invoked by the super-user, 145.Nm 146clears the set-user-id and set-group-id bits on a file to prevent 147accidental or mischievous creation of set-user-id or set-group-id 148programs. 149.Sh FILES 150.Bl -tag -width /etc/group -compact 151.It Pa /etc/group 152Group ID file 153.El 154.Sh EXIT STATUS 155.Ex -std chgrp 156.Sh SEE ALSO 157.Xr chown 2 , 158.Xr lchown 2 , 159.Xr fts 3 , 160.Xr group 5 , 161.Xr passwd 5 , 162.Xr symlink 7 , 163.Xr chown 8 164.Sh STANDARDS 165The 166.Nm 167utility is expected to be POSIX 1003.2 compatible. 168.Pp 169The 170.Fl v 171and 172.Fl d 173options and the use of ``#'' to force a numeric group ID 174are extensions to 175.St -p1003.2 . 176