NEWGRPSection: User Commands (1)
Index Return to Main Contents
NAMEnewgrp - log in to a new group
sg - execute command as different group ID
SYNOPSISnewgrp [-] [group]
sg [-] [group [[-c] command]]
DESCRIPTIONnewgrp is used to change the current group ID during a login session. If the optional - flag is given, the user's environment will be reinitialized as though the user had logged in, otherwise the current environment, including current working directory, remains unchanged.
newgrp changes the current real group ID to the named group, or to the default group listed in /etc/passwd if no group name is given. The user will be prompted for a password if she do not have a password and the group does, or if the user is not listed as a member and the group has a password. The user will be denied access if the group password is empty and the user is not listed as a member.
The sg command works similiar to newgrp but accepts a command. The command will be executed with the Bourne shell. With most shells you may run sg from, you need to enclose multi-word commands in quotes. Another difference between newgrp and sg is that some shells treat newgrp specially, replacing themselves with a new instance of a shell that newgrp creates. This doesn't happen with sg, so upon exit from a sg command you are returned to your previous group ID.
FILES/etc/passwd - user account information
/etc/group - group information
SEE ALSOid(1), login(1), su(1)
AUTHORJulianne Frances Haugh <firstname.lastname@example.org>