129f48d62STim J. Robbins.\" Copyright (c) 2002 Tim J. Robbins. 229f48d62STim J. Robbins.\" All rights reserved. 329f48d62STim J. Robbins.\" 429f48d62STim J. Robbins.\" Redistribution and use in source and binary forms, with or without 529f48d62STim J. Robbins.\" modification, are permitted provided that the following conditions 629f48d62STim J. Robbins.\" are met: 729f48d62STim J. Robbins.\" 1. Redistributions of source code must retain the above copyright 829f48d62STim J. Robbins.\" notice, this list of conditions and the following disclaimer. 929f48d62STim J. Robbins.\" 2. Redistributions in binary form must reproduce the above copyright 1029f48d62STim J. Robbins.\" notice, this list of conditions and the following disclaimer in the 1129f48d62STim J. Robbins.\" documentation and/or other materials provided with the distribution. 1229f48d62STim J. Robbins.\" 1329f48d62STim J. Robbins.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1429f48d62STim J. Robbins.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1529f48d62STim J. Robbins.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1629f48d62STim J. Robbins.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1729f48d62STim J. Robbins.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1829f48d62STim J. Robbins.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1929f48d62STim J. Robbins.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2029f48d62STim J. Robbins.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2129f48d62STim J. Robbins.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2229f48d62STim J. Robbins.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2329f48d62STim J. Robbins.\" SUCH DAMAGE. 2429f48d62STim J. Robbins.\" 25*30c4fc7cSDag-Erling Smørgrav.Dd February 8, 2013 2629f48d62STim J. Robbins.Dt NEWGRP 1 2729f48d62STim J. Robbins.Os 2829f48d62STim J. Robbins.Sh NAME 2929f48d62STim J. Robbins.Nm newgrp 3029f48d62STim J. Robbins.Nd change to a new group 3129f48d62STim J. Robbins.Sh SYNOPSIS 3229f48d62STim J. Robbins.Nm 3329f48d62STim J. Robbins.Op Fl l 3429f48d62STim J. Robbins.Op Ar group 3529f48d62STim J. Robbins.Sh DESCRIPTION 3629f48d62STim J. RobbinsThe 3729f48d62STim J. Robbins.Nm 3829f48d62STim J. Robbinsutility creates a new shell execution environment with modified 3929f48d62STim J. Robbinsreal and effective group IDs. 4029f48d62STim J. Robbins.Pp 4129f48d62STim J. RobbinsThe options are as follows: 4229f48d62STim J. Robbins.Bl -tag -width indent 4329f48d62STim J. Robbins.It Fl l 4429f48d62STim J. RobbinsSimulate a full login. 4529f48d62STim J. RobbinsThe environment and umask are set to what would be expected if the user 4629f48d62STim J. Robbinsactually logged in again. 4729f48d62STim J. Robbins.El 4829f48d62STim J. Robbins.Pp 4929f48d62STim J. RobbinsIf the 5029f48d62STim J. Robbins.Ar group 5129f48d62STim J. Robbinsoperand is present, a new shell is started with the specified effective 5229f48d62STim J. Robbinsand real group IDs. 5329f48d62STim J. RobbinsThe user will be prompted for a password if they are not a member of the 5429f48d62STim J. Robbinsspecified group. 5529f48d62STim J. Robbins.Pp 5629f48d62STim J. RobbinsOtherwise, the real, effective and supplementary group IDs are restored to 5729f48d62STim J. Robbinsthose from the current user's password database entry. 58a866e170SRuslan Ermilov.Sh EXIT STATUS 5929f48d62STim J. RobbinsThe 6029f48d62STim J. Robbins.Nm 618bf118edSRuslan Ermilovutility attempts to start the shell regardless of whether group IDs 6229f48d62STim J. Robbinswere successfully changed. 6329f48d62STim J. Robbins.Pp 6429f48d62STim J. RobbinsIf an error occurs and the shell cannot be started, 6529f48d62STim J. Robbins.Nm 6629f48d62STim J. Robbinsexits >0. 6729f48d62STim J. RobbinsOtherwise, the exit status of 6829f48d62STim J. Robbins.Nm 6929f48d62STim J. Robbinsis the exit status of the shell. 7029f48d62STim J. Robbins.Sh SEE ALSO 7129f48d62STim J. Robbins.Xr csh 1 , 7229f48d62STim J. Robbins.Xr groups 1 , 7329f48d62STim J. Robbins.Xr login 1 , 7429f48d62STim J. Robbins.Xr sh 1 , 7529f48d62STim J. Robbins.Xr su 1 , 7629f48d62STim J. Robbins.Xr umask 1 , 7729f48d62STim J. Robbins.Xr group 5 , 7829f48d62STim J. Robbins.Xr passwd 5 , 7929f48d62STim J. Robbins.Xr environ 7 8029f48d62STim J. Robbins.Sh STANDARDS 8129f48d62STim J. RobbinsThe 8229f48d62STim J. Robbins.Nm 8329f48d62STim J. Robbinsutility conforms to 8429f48d62STim J. Robbins.St -p1003.1-2001 . 8529f48d62STim J. Robbins.Sh HISTORY 8629f48d62STim J. RobbinsA 8729f48d62STim J. Robbins.Nm 8829f48d62STim J. Robbinsutility appeared in 8929f48d62STim J. Robbins.At v6 . 9029f48d62STim J. Robbins.Sh BUGS 91*30c4fc7cSDag-Erling SmørgravFor security reasons, the 92*30c4fc7cSDag-Erling Smørgrav.Nm 93*30c4fc7cSDag-Erling Smørgravutility is normally installed without the setuid bit. 94*30c4fc7cSDag-Erling SmørgravTo enable it, run the following command: 95*30c4fc7cSDag-Erling Smørgrav.Bd -literal -offset indent 96*30c4fc7cSDag-Erling Smørgravchmod u+s /usr/bin/newgrp 97*30c4fc7cSDag-Erling Smørgrav.Ed 98*30c4fc7cSDag-Erling Smørgrav.Pp 9929f48d62STim J. RobbinsGroup passwords are inherently insecure as there is no way to stop 100*30c4fc7cSDag-Erling Smørgravusers obtaining the password hash from the group database. 10129f48d62STim J. RobbinsTheir use is discouraged. 102*30c4fc7cSDag-Erling SmørgravInstead, users should simply be added to the necessary groups. 103