NEWGRP(1) SysV NEWGRP(1)
NAME
newgrp - log in to a new group
SYNOPSIS
newgrp [ - ] [ group ]
DESCRIPTION
The newgrp command changes your group identification. Although you
remain logged in during the process, and your current directory is
unchanged, newgrp sets new real and effective group IDs. The shell then
performs calculations of access permissions to files with respect to
these new IDs. You are always given a new shell to replace the current
shell, regardless of whether newgrp terminates successfully or due to an
error condition (e.g., unknown group).
Exported variables retain their values after you invoke newgrp. All
unexported variables, however, are either reset to their default value or
set to null. Unless you or the system itself exports system variables
(e.g., PS1, PS2, PATH, MAIL, HOME), they are reset to default values.
For example, suppose you have a primary prompt string (PS1) other than
the default, a pound sign (#), and you have not exported PS1. After
invoking newgrp, successfully or not, your PS1 variable is set to the
default prompt string, the pound sign (#). Use the shell command, export,
to export variables so that they retain their assigned value when
invoking new shells. See sh(1) for more information.
With no arguments, newgrp changes the group identification back to the
group specified in the your password file entry. If the first argument to
newgrp is a dash (-), the environment changes to one that you would
normally expect if you logged in again.
The newgrp command lets you change to any group of which you are a
member. The /etc/group file contains a list of all groups and the group's
members. You are a member of all groups for which you have an account.
For example, if you have the following three registry accounts,
user1.project1.org
user1.project2.org
user1.project3.org
you are listed three times in the /etc/group file. You may not be listed
in the group entry for your default group.
The /etc/passwd file contains your default group. Even though this may
not appear in the /etc/group file, this group is always available as an
option to the newgrp command.
FILES
/etc/group System's group file
/etc/passwd System's password file
SEE ALSO
login(1), sh(1), group(4), passwd(4), environ(5).