Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
NEWGRP(1)		     General Commands Manual		       NEWGRP(1)

NAME
     newgrp -- change to a new group

SYNOPSIS
     newgrp [-l] [group]

DESCRIPTION
     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.  Oth-
     erwise, the exit status of newgrp is the exit status of the shell.

EXAMPLES
     Create a new group, foo, with pw(8):

	   pw group add foo

     Set the group password:

	   pw group mod foo -h 0

     As a non-root user, switch to the group:

	   newgrp foo

SEE ALSO
     csh(1), groups(1), login(1), sh(1), su(1), umask(1),  group(5),  passwd(5),
     environ(7), groups(7)

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
     For  security reasons, the newgrp utility is normally installed without the
     setuid bit.  To enable it, run the following command:

	   chmod u+s /usr/bin/newgrp

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

FreeBSD ports 15.quarterly	 April 19, 2026 		       NEWGRP(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=newgrp&manpath=FreeBSD+15.1-RELEASE+and+Ports.quarterly>

home | help