1.\" Copyright (c) 2002 Tim J. Robbins. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $FreeBSD: src/usr.bin/newgrp/newgrp.1,v 1.2 2002/05/30 13:57:35 ru Exp $ 26.\" $DragonFly: src/usr.bin/newgrp/newgrp.1,v 1.1 2004/11/23 16:26:04 liamfoy Exp $ 27.\" 28.Dd November 24, 2013 29.Dt NEWGRP 1 30.Os 31.Sh NAME 32.Nm newgrp 33.Nd change to a new group 34.Sh SYNOPSIS 35.Nm 36.Op Fl l 37.Op Ar group 38.Sh DESCRIPTION 39The 40.Nm 41utility creates a new shell execution environment with modified 42real and effective group IDs. 43.Pp 44The options are as follows: 45.Bl -tag -width indent 46.It Fl l 47Simulate a full login. 48The environment and umask are set to what would be expected if the user 49actually logged in again. 50.El 51.Pp 52If the 53.Ar group 54operand is present, a new shell is started with the specified effective 55and real group IDs. 56The user will be prompted for a password if they are not a member of the 57specified group. 58.Pp 59Otherwise, the real, effective and supplementary group IDs are restored to 60those from the current user's password database entry. 61.Sh DIAGNOSTICS 62The 63.Nm 64utility attempts to start the shell regardless of whether group IDs 65were successfully changed. 66.Pp 67If an error occurs and the shell cannot be started, 68.Nm 69exits >0. 70Otherwise, the exit status of 71.Nm 72is the exit status of the shell. 73.Sh SEE ALSO 74.Xr csh 1 , 75.Xr groups 1 , 76.Xr login 1 , 77.Xr sh 1 , 78.Xr su 1 , 79.Xr umask 1 , 80.Xr group 5 , 81.Xr passwd 5 , 82.Xr environ 7 83.Sh STANDARDS 84The 85.Nm 86utility conforms to 87.St -p1003.1-2001 . 88.Sh HISTORY 89A 90.Nm 91utility appeared in 92.At v6 . 93.Sh BUGS 94For security reasons, the 95.Nm 96utility is normally installed without the setuid bit. 97To enable it, run the following command: 98.Bd -literal -offset indent 99chmod u+s /usr/bin/newgrp 100.Ed 101.Pp 102Group passwords are inherently insecure as there is no way to stop 103users obtaining the password hash from the group database. 104Their use is discouraged. 105Instead, users should simply be added to the necessary groups. 106