newgrp

Autres langues

Langue: en

Version: 57987 (mandriva - 22/10/07)

Section: 1 (Commandes utilisateur)

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 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. 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 SHADOWPWD (respectively SHADOWGRP) defined, the password of the user (respectively, 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 command 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 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/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>