newgrp(8) CLIX newgrp(8)
NAME
newgrp - Changes a user's group identification
SYNOPSIS
newgrp [-] [group]
FLAGS
- Causes the environment to change to the conditions that would normally
be expected if the user actually logged in again as a member of the
new group.
DESCRIPTION
The newgrp command changes a user's group identification. The user
remains logged in and the current directory is unchanged, but calculations
of access permissions to files are performed with respect to the new real
and effective group. The user is always given a new shell, replacing the
current shell, regardless of whether it terminated successfully or due to
an error condition (that is, unknown group).
Exported variables retain their values after invoking newgrp; however, all
unexported variables are either reset to their default value or set to
null. System variables (such as $PS1, $PS2, $PATH, $MAIL, and $HOME),
unless exported by the system or explicitly exported by the user, are
reset to default values. For example, a user has a primary prompt string
($PS1) other than $ (default) and has not exported $PS1. After an
invocation of the newgrp, successful or not, their $PS1 will now be set to
the default prompt string $. Note that the shell command export (see the
sh command) is the method used to export variables so that they retain
their assigned value when invoking new shells.
With no arguments, the newgrp command changes the group identification
back to the group specified in the user's password file entry. This is a
way the user can exit the effect of an earlier newgrp command.
If the first argument to newgrp is -, the environment is changed to what
would be expected if the user actually logged in again as a member of the
new group.
A password is demanded if the group has a password and the user does not,
or if the group has a password and the user is not listed in the
/etc/group file as being a member of that group.
EXAMPLES
The following command changes the user's group to sys, if allowed.
newgrp sys
2/94 - Intergraph Corporation 1
newgrp(8) CLIX newgrp(8)
FILES
/etc/group System's group file
/etc/passwd System's password file
NOTES
There is no convenient way to enter a password into /etc/group. Use of
group passwords is not encouraged, because, by their very nature, they
encourage poor security practices.
DIAGNOSTICS
The group given is not in the /etc/group file:
newgrp: Unknown group
A new shell could not be executed for the user:
newgrp: You have no shell
EXIT VALUES
The newgrp command exits with a value of 1 when an error occurs.
RELATED INFORMATION
Commands: groups(1), login(1), sh(1)
Files: group(4), passwd(4), environ(4)
2 Intergraph Corporation - 2/94