newgrp(1M)


newgrp -- log in to a new group

Synopsis

newgrp [- | -l] [group]

Description

The command newgrp changes a user's real and effective group identification. The user remains logged in and the current directory is unchanged. The user is given a new shell that replaces the current shell, whether newgrp terminated successfully or due to an error condition. A new shell is created even if the group is not changed.

Exported variables retain their values after invoking newgrp; however, all unexported variables are either reset to their default value or set to null. Environment 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 newgrp, successful or not, the user's PS1 will now be set to the default prompt string ``$''. The shell command export (see the sh(1) manual page) should be used to export variables so that they retain their assigned value when new shells are invoked.

With no arguments, newgrp changes the user's group IDs (real and effective) back to the group specified in the user's password file entry. This is a way to undo the effect of an earlier newgrp command.

If the first argument to newgrp is a - or -l, the environment is changed to what would be expected if the user logged in again as a member of the new group.

Files


/etc/group
system's group file

/etc/passwd
system's password file

/usr/lib/locale/locale/LC_MESSAGES/uxcore.abi
language-specific message file (see LANG on environ(5)).

References

environ(5), group(4), intro(2), login(1), passwd(4), sh(1), usermod(1M)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004