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