1.\" $NetBSD: newgrp.1,v 1.4 2010/05/14 17:28:23 joerg Exp $ 2.\" 3.\" Copyright (c) 2007, The NetBSD Foundation. 4.\" All Rights Reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Brian Ginsbach. 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.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd June 6, 2007 31.Dt NEWGRP 1 32.Os 33.Sh NAME 34.Nm newgrp 35.Nd change to a new primary group 36.Sh SYNOPSIS 37.Nm 38.Op Fl l 39.Op Ar group 40.Sh DESCRIPTION 41The 42.Nm 43command changes a user to a new primary group 44.Pq real and effective group ID 45by starting a new shell. 46The user remains logged in and the current directory 47and file creation mask remain unchanged. 48The user is always given a new shell even if 49the primary group change fails. 50.Pp 51The 52.Nm 53command accepts the following options: 54.Bl -tag -width indent 55.It Fl l 56The environment is changed to what would be expected if the user 57actually logged in again. 58This simulates a full login. 59.El 60.Pp 61The 62.Ar group 63is a group name or non-negative numeric group ID from the group database. 64The real and effective group IDs are set to 65.Ar group 66or the group ID associated with the group name. 67.Pp 68If 69.Ar group 70is not specified, 71.Nm 72restores the user's real and effective group IDs to the user's 73primary group specified in the password database. 74The user's supplementary group IDs are restored to the set specified 75for the user in the group database. 76.Pp 77If the user is not a member of the specified group, and the group 78requires a password, the user will be prompted for the group password. 79.Sh FILES 80.Bl -tag -width /etc/master.passwd -compact 81.It Pa /etc/group 82The group database 83.It Pa /etc/master.passwd 84The user database 85.It Pa /etc/passwd 86A Version 7 format password file 87.El 88.Sh EXIT STATUS 89If a new shell is started the exit status is the exit status of the shell. 90Otherwise the exit status will be \*[Gt]0. 91.Sh SEE ALSO 92.Xr csh 1 , 93.Xr groups 1 , 94.Xr login 1 , 95.Xr sh 1 , 96.Xr su 1 , 97.Xr umask 2 , 98.Xr group 5 , 99.Xr passwd 5 , 100.Xr environ 7 101.Sh STANDARDS 102The 103.Nm 104command conforms to 105.St -p1003.1-2001 . 106.Sh HISTORY 107A 108.Nm 109command appeared in 110.At v6 . 111A 112.Nm 113command appeared in 114.Nx 5.0 . 115.Sh BUGS 116There is no convenient way to enter a password into 117.Pa /etc/group . 118The use of group passwords is strongly discouraged 119since they are inherently insecure. 120It is not possible to stop users from obtaining the encrypted 121password from the group database. 122