newgrp(C)


newgrp -- change to a new group

Syntax

newgrp [ -l ] [ group ]

newgrp [ - ] [ group ]

Description

newgrp sets new real and effective group IDs. You remain logged in, and your current directory is unchanged, but calculations of access permissions on files are performed with respect to the new group IDs.

Each time you invoke newgrp, it changes your supplementary group IDs to the groups that list you as a member in the group file (/etc/group).

With no operands, newgrp changes your real and effective group IDs to your login group in the password file (/etc/passwd), and sets the list of supplementary groups to that set in the user's group database entries.

The newgrp utility affects the supplemental groups for the process as follows:

You can change to a new real and effective group, specified as a group name or a numeric group ID, provided you are listed as a member of that group in the group file.

You are prompted for a password if you try to change to a group of which you are not a member, and that has an encrypted group password. Your real and effective group IDs are changed if you enter the correct password (see ``Limitations'').

You cannot change to a group that does not have a group password, and that does not list you as a member.

The -l option logs you in again with a real and effective group IDs of group, if specified; otherwise, your real and effective group IDs are set to your login group in the password file.

The - option is equivalent to -l.

Exit values

If newgrp succeeds in creating a new shell execution environment, irrespective of whether the group ID is changed, the exit status is that of the shell. Otherwise, a value greater than 0 is returned in order to signal that an error occurred.

Limitations

newgrp executes, but does not fork, a new shell.

No command is provided to set group passwords in the group file. A system that uses group passwords is not C2 secure.

Files


/etc/group
the list of group names, IDs, and users belonging to groups

/etc/passwd
the password file containing the login group for each user

See also

csh(C), group(F), ksh(C), login(M), passwd(F), sg(C)

Standards conformance

newgrp is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005