2007-10-07 17:16:07 +05:30
|
|
|
.\"$Id: newgrp.1,v 1.23 2005/04/12 18:08:46 kloczek Exp $
|
2007-10-07 17:14:44 +05:30
|
|
|
.\" Copyright 1991, Julianne Frances Haugh
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. Neither the name of Julianne F. Haugh nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.TH NEWGRP 1
|
|
|
|
.SH NAME
|
2007-10-07 17:15:14 +05:30
|
|
|
newgrp \- log in to a new group
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:15:14 +05:30
|
|
|
sg \- execute command as different group ID
|
2007-10-07 17:14:44 +05:30
|
|
|
.SH SYNOPSIS
|
2007-10-07 17:16:07 +05:30
|
|
|
\fBnewgrp\fR [\fB\-\fR] [\fIgroup\fR]
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:16:07 +05:30
|
|
|
\fBsg\fR [\fB\-\fR] [\fIgroup\fR [[\fB\-c\fR] \fIcommand\fR]]
|
2007-10-07 17:14:44 +05:30
|
|
|
.SH DESCRIPTION
|
2007-10-07 17:14:51 +05:30
|
|
|
\fBnewgrp\fR is used to change the current group ID during a login session.
|
2007-10-07 17:15:23 +05:30
|
|
|
If the optional \fB\-\fR 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.
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:14:51 +05:30
|
|
|
\fBnewgrp\fR changes the current real group ID to the named group, or to the
|
2007-10-07 17:16:07 +05:30
|
|
|
default group listed in \fI/etc/passwd\fR if no group name is given.
|
|
|
|
\fBnewgrp\fR 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 \fI/etc/shadow\fR (respectively in
|
|
|
|
\fI/etc/gshadow\fR) if an entry exists for this user (resp. group).
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:15:58 +05:30
|
|
|
The \fBsg\fR command works similar to \fBnewgrp\fR but accepts a command.
|
2007-10-07 17:16:07 +05:30
|
|
|
The command will be executed with the \fB/bin/sh\fR shell. With most shells you
|
|
|
|
may run \fBsg\fR from, you need to enclose multi\-word commands in quotes.
|
2007-10-07 17:15:14 +05:30
|
|
|
Another difference between \fBnewgrp\fR and \fBsg\fR is that some shells
|
2007-10-07 17:15:23 +05:30
|
|
|
treat \fBnewgrp\fR specially, replacing themselves with a new instance of a
|
|
|
|
shell that \fBnewgrp\fR creates. This doesn't happen with \fBsg\fR, so upon
|
|
|
|
exit from a \fBsg\fR command you are returned to your previous group ID.
|
2007-10-07 17:14:44 +05:30
|
|
|
.SH FILES
|
2007-10-07 17:16:07 +05:30
|
|
|
\fI/etc/passwd\fR \- user account information
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:16:07 +05:30
|
|
|
\fI/etc/shadow\fR \- secure user account information
|
|
|
|
.br
|
|
|
|
\fI/etc/group\fR \- group account information
|
|
|
|
.br
|
|
|
|
\fI/etc/gshadow\fR \- shadow group file
|
2007-10-07 17:14:44 +05:30
|
|
|
.SH SEE ALSO
|
|
|
|
.BR id (1),
|
2007-10-07 17:15:14 +05:30
|
|
|
.BR login (1),
|
2007-10-07 17:16:07 +05:30
|
|
|
.BR su (1),
|
|
|
|
.BR gpasswd (1),
|
|
|
|
.BR group (5),
|
|
|
|
.BR gshadow (5)
|
2007-10-07 17:14:44 +05:30
|
|
|
.SH AUTHOR
|
2007-10-07 17:15:14 +05:30
|
|
|
Julianne Frances Haugh <jockgrrl@ix.netcom.com>
|