newgrp(1)

newgrp1

Change to a new group

Usage

newgrp [-l] [group]

Overview

The newgrp utility creates a new shell execution environment with modified real and effective group IDs.

The options are as follows:

-l

Simulate a full login. The environment and umask are set to what would be expected if the user actually logged in again.

If the group operand is present, a new shell is started with the specified effective and real group IDs. The user will be prompted for a password if they are not a member of the specified group.

Otherwise, the real, effective and supplementary group IDs are restored to those from the current user's password database entry.

Exit status

The newgrp utility attempts to start the shell regardless of whether group IDs were successfully changed.

If an error occurs and the shell cannot be started, newgrp exits >0. Otherwise, the exit status of newgrp is the exit status of the shell.

Releases

115 releases since Mac OS X 10.5; the text changed 2 times.

  1. 10.5–10.5.8
  2. 10.6–12.5
  3. 13.0–26.5

Standards

The newgrp utility conforms to IEEE Std 1003.1-2001 (“POSIX.1”).

History

A newgrp utility appeared in Version 6 AT&T UNIX.

Bugs

Group passwords are inherently insecure as there is no way to stop users obtaining the password hash from the group database. Their use is discouraged. Instead, users should simply be added to the necessary groups.

From system_cmds 1042.120.1 in macOS 26.5. Parsed by carta from the page's mdoc source.