Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)
Table Of Contents
User Commands (m - o) newgrp(1)
NAME
newgrp - Changes the shell process to a new group
SYNOPSIS
newgrp [-][group]
FLAGS
- Changes the login environment as well as the primary group identification.
DESCRIPTION
The newgrp command changes the primary group identification of the current shell process to
group. Both the user’s real group ID and effective group ID are changed. Any active user-
generated shell is terminated.
The user remains logged in and the current directory is unchanged. Execution of the newgrp
command always replaces the current shell with a new shell, even when the command terminates
with an error (such as unknown group).
The program used as the new shell is chosen as follows:
1. The program file specified in the security database as the INITIAL-PROGRAM attribute
of the user ID is run.
2. If the INITIAL-PROGRAM attribute is not specified, the program file specified as the
most recently exported value for the SHELL environment variable is run.
If you specify a - (dash), newgrp also changes the login environment of the new shell process to
the login environment of the new group.
Operands
group Specifies the group name of the group to which the primary group identification
of the shell should be changed.
If you do not specify a group, newgrp changes the primary group identification
to the default group specified for the current user in the system security database.
Only a user with appropriate privileges can change the primary group
identification of the shell to a group to which that user does not belong.
Environment Variables
This command supports the use of the LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
NLSPATH, and SHELL environment variables.
EXIT VALUES
When the newgrp command successfully creates a new shell execution environment, it returns
the exit value of the old shell execution environment. This exit value does not necessarily indi-
cate that the primary group identification was successfully changed.
When the newgrp command fails, it returns the following values:
>0 An error occurred.
RELATED INFORMATION
Commands: sh(1).
STANDARDS CONFORMANCE
This command conforms to the obsolescent alternative within the XPG4 Version 2 specification.
The -l flag is not supported.
527188-003 Hewlett-Packard Company 6−35