sg



NEWGRP(1)                                                            NEWGRP(1)




NAME

       newgrp - log in to a new group
       sg - execute command as different group ID


SYNOPSIS

       newgrp [-] [group]
       sg [-] [group [[-c] command]]


DESCRIPTION

       newgrp  is  used to change the current group ID during a login session.
       If the optional - flag is given, the user’s environment will be  reini-
       tialized  as though the user had logged in, otherwise the current envi-
       ronment, 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.  newgrp
       also tries to add the group to the user groupset. If not root, 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.  If compiled with SHADOW-
       PWD (respectively SHADOWGRP) defined, the password of the user (respec-
       tively, the password and the members of the group) will be  overwritten
       by  the  value defined in /etc/shadow (respectively in /etc/gshadow) if
       an entry exists for this user (resp. group).

       The sg command works similar to newgrp but accepts a command.  The com-
       mand  will be executed with the /bin/sh 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 new-
       grp 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/shadow    - secure user account information
       /etc/group     - group account information
       /etc/gshadow   - shadow group file


SEE ALSO

       id(1), login(1), su(1), gpasswd(1), group(5), gshadow(5)


AUTHOR

       Julianne Frances Haugh <jockgrrl@ix.netcom.com>



                                                                     NEWGRP(1)

Man(1) output converted with man2html