1.\" $OpenBSD: chgrp.1,v 1.17 2015/12/31 23:38:16 guenther 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: December 31 2015 $ 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 62Treat symbolic links like other files: modify links instead of 63following them. 64The 65.Fl h 66and 67.Fl R 68options are mutually exclusive. 69.It Fl L 70If the 71.Fl R 72option is specified, all symbolic links are followed. 73.It Fl P 74If the 75.Fl R 76option is specified, no symbolic links are followed. 77.It Fl R 78Recurse. 79Where 80.Ar file 81is a directory, 82change the group ID of the directory and all the files and directories 83in the file hierarchy below it. 84.El 85.Pp 86The 87.Fl H , 88.Fl L , 89and 90.Fl P 91options are ignored unless the 92.Fl R 93option is specified; 94if none of them are given, 95the default is to not follow symbolic links. 96In addition, these options override each other and the 97command's actions are determined by the last one specified. 98.Pp 99The 100.Ar group 101operand can be either a group name from the group database, 102or a numeric group ID. 103If a group name is also a numeric group ID, the operand is used as a 104group name. 105.Pp 106By default, 107.Nm 108clears the set-user-ID and set-group-ID bits on the file 109to prevent accidental or mischievous creation of 110set-user-ID and set-group-ID programs. 111This behaviour can be overridden by setting the 112.Xr sysctl 8 113variable 114.Va fs.posix.setuid 115to zero. 116.Pp 117The user invoking 118.Nm 119must belong to the specified group and be the owner of the file, 120or be the superuser. 121.Sh FILES 122.Bl -tag -width /etc/group -compact 123.It Pa /etc/group 124group ID file 125.El 126.Sh EXIT STATUS 127.Ex -std chgrp 128.Sh SEE ALSO 129.Xr chown 2 , 130.Xr fts 3 , 131.Xr group 5 , 132.Xr passwd 5 , 133.Xr symlink 7 , 134.Xr chown 8 135.Sh STANDARDS 136The 137.Nm 138utility is compliant with the 139.St -p1003.1-2008 140specification. 141