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