NEWGRP(1) NEWGRP(1)
名前
newgrp - 新しいグループにログインする
sg - 別のグループ ID でコマンドを実行する
書式
newgrp [-] [group]
sg [-] [group [[-c] command]]
説明
newgrp はログインセッション中に現在のグループ ID を変更するために用いら
れる。オプションとして - フラグを与えた場合は、新たにログインしたのと同
じ 様に環境が再初期化される。そうでない場合は、現在の作業ディレクトリを
含めて、現在の環境は変化しない。
newgrp は現在の実グループ ID を、指定したグループに (グループ名を指定し
なかった場合は /etc/passwd に記載されたデフォルトのグループに) 変更する
。ユーザにはパスワードがなくグループにはある場合、あるいはユーザがグ ル
ー プのメンバーではなくグループにパスワードがある場合には、そのユーザは
パスワードの入力を求められる。グループのパスワードが設定されておらず 、
かつユーザがグループのメンバーでない場合は、アクセスは拒否される。
sg コマンドは newgrp と同様に動作するが、コマンドを受け付ける。このコマ
ンドは /bin/sh シェルで実行される。コマンドが複数の単語からなる場合は、
sg の実行元となるであろうシェルのほとんどにおいて、これらをクォートする
必要があるだろう。 newgrp と sg のもう一つの違いは、特定のシェルが new-
grp を特別に扱う点にある。このようなシェルは、自分自身を newgrp が生成
した新しい実体と置き換える。このようなことは sg では起きないので 、 sg
コマンドから戻った際には以前のグループ ID に戻る。
ファイル
/etc/passwd - ユーザアカウント情報
/etc/group - グループ情報
関連項目
id(1), login(1), su(1)
著者
Julianne Frances Haugh
NEWGRP(1) User Commands NEWGRP(1) NAME newgrp - log in to a new group SYNOPSIS newgrp [-] [group] DESCRIPTION The newgrp command 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 does not have a password (in /etc/shadow if this user has an entry in the shadowed password file, or in /etc/passwd otherwise) 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 there is an entry for this group in /etc/gshadow, then the list of members and the password of this group will be taken from this file, otherwise, the entry in /etc/group is considered. CONFIGURATION The following configuration variables in /etc/login.defs change the behavior of this tool: SYSLOG_SG_ENAB (boolean) Enable "syslog" logging of sg activity. FILES /etc/passwd User account information. /etc/shadow Secure user account information. /etc/group Group account information. /etc/gshadow Secure group account information. SEE ALSO id(1), login(1), su(1), sg(1), gpasswd(1), group(5), gshadow(5). shadow-utils 4.1.5.1 05/10/2016 NEWGRP(1)
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa