- NetBSD Manual Pages
NEWGRP(1) NetBSD General Commands Manual NEWGRP(1)
Powered by man-cgi (2021-06-01).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
newgrp -- change to a new primary group
newgrp [-l] [group]
The newgrp command changes a user to a new primary group (real and
effective group ID) by starting a new shell. The user remains logged in
and the current directory and file creation mask remain unchanged. The
user is always given a new shell even if the primary group change fails.
The newgrp command accepts the following options:
-l The environment is changed to what would be expected if the user
actually logged in again. This simulates a full login.
The group is a group name or non-negative numeric group ID from the group
database. The real and effective group IDs are set to group or the group
ID associated with the group name.
If group is not specified, newgrp restores the user's real and effective
group IDs to the user's primary group specified in the password database.
The user's supplementary group IDs are restored to the set specified for
the user in the group database.
If the user is not a member of the specified group, and the group
requires a password, the user will be prompted for the group password.
/etc/group The group database
/etc/master.passwd The user database
/etc/passwd A Version 7 format password file
If a new shell is started the exit status is the exit status of the
shell. Otherwise the exit status will be >0.
csh(1), groups(1), login(1), sh(1), su(1), umask(2), group(5), passwd(5),
The newgrp command conforms to IEEE Std 1003.1-2001 (``POSIX.1'').
A newgrp command appeared in Version 6 AT&T UNIX. A newgrp command
appeared in NetBSD 5.0.
There is no convenient way to enter a password into /etc/group. The use
of group passwords is strongly discouraged since they are inherently
insecure. It is not possible to stop users from obtaining the encrypted
password from the group database.
NetBSD 7.1.2 June 6, 2007 NetBSD 7.1.2