命令行大全

newgrp

rose1 发表于 2020-10-13 09:04浏览次数:

在类似Unix的操作系统上,newgrp命令配置用户将用来登录的组成员身份。 本文档介绍了newgrp的GNU / Linux版本。

查看英文版

目录:

1 newgrp 运行系统环境

2 newgrp 说明

3 newgrp 语法

4 newgrp 例子

newgrp 运行系统环境

Linux

newgrp 说明

使用newgrp命令用于登录会话期间改变当前的组ID(GID)。如果将连字符(“ - ”)用作参数,则将初始化用户的环境,就像他或她刚刚登录一样;否则,将初始化用户的环境。否则,当前的工作环境将保持不变。newgrp将当前的实际组ID更改为指定的组,或者,如果未指定任何组,则更改为文件/ etc / passwd中列出的默认组。newgrp还将尝试将组添加到用户组集中。

如果用户为root,则不会提示他或她输入密码。

如果用户不是root用户,则在以下情况下将提示他或她输入组密码:

  • 用户没有密码,但组有密码,或者
  • 该用户未作为组成员列出,并且该组具有密码。

如果未设置组密码,并且该用户未列为该组的成员,则将拒绝该用户访问。

如果阴影的组密码文件/ etc / gshadow中有该组的条目,则将从该文件中获取该组的成员列表和密码。否则,将使用/ etc / group中的组条目。

The newgrp command is used to change the current group ID (GID) during a login session. If a hyphen ("-") is included as an argument, then the user's environment is initialized as though he or she had just logged in; otherwise, the current working environment remains unchanged. newgrp changes the current real group ID to the specified group, or, if no group is specified, to the default group listed in the file /etc/passwdnewgrp also tries to add the group to the user groupset.

If the user is root, he or she will not be prompted for a password.

If the user is not root, he or she will be prompted for a group password if:

  • the user does not have a password, but the group does, or if
  • the user is not listed as a group member, and the group has a password.

If there is no group password set, and the user is not listed as a member of the group, the user will be denied access.

If there is an entry for the group in the shadowed group password file, /etc/gshadow, then the list of members and the password for this group will be taken from this file. Otherwise, the group entry in /etc/group is used.

查看英文版

查看中文版

newgrp 语法

newgrp [-] [group]

文件

newgrp使用以下文件:

/etc/passwd 用户帐户信息。
/etc/shadow 安全的用户帐户信息。
/etc/group 组帐户信息。
/etc/gshadow 安全的组帐户信息。
newgrp [-] [group]

Files

newgrp makes use of the following files:

/etc/passwd User account information.
/etc/shadow Secure user account information.
/etc/group Group account information.
/etc/gshadow Secure group account information.

查看英文版

查看中文版

newgrp 例子

newgrp developers

尝试登录到组开发人员。

newgrp - developers

尝试登录到组开发人员,如果成功,则重新初始化用户环境。

newgrp developers

Attempts to log in to the group developers.

newgrp - developers

Attempts to log in to the group developers, and, if successful, re-initializes the user environment.

查看英文版

查看中文版