命令行大全

groupmod

舞夕之 发表于 2020-07-18 03:14浏览次数:

Groupmod命令通过修改文件/etc/group、/etc/gdow和/etc/passwd中的相应条目来修改指定组的定义。

查看英文版

目录:

1 groupmod 运行系统环境

2 groupmod 语法

3 groupmod 语法

groupmod 运行系统环境

Unix&Linux

groupmod 语法

groupmod [options] GROUP
选项

-g,--gid GID

给定GROUP的组ID将更改为GID。

GID的值必须是非负十进制整数。除非使用-o选项,否则该值必须唯一。

使用该组作为主要组的用户将被更新,以将该组保留为其主要组。

具有旧组ID且必须继续属于GROUP的任何文件都必须手动更改其组ID。

将不会对/etc/login.defs中的GID_MIN,GID_MAX,SYS_GID_MIN或SYS_GID_MAX进行检查。

-h,--help

显示帮助消息并退出。

-n,--new-nameNEW_GROUP

该组的名称将从GROUP更改为NEW_GROUP。

-o,--non-unique

与-g选项一起使用时,允许将组GID更改为非唯一值。

-p,--passwordPASSWORD

该加密的密码,通过隐窝返回。

注意:不建议使用此选项,因为列出进程的用户将看到密码(或加密的密码)。

您应该确保密码遵守系统的密码策略。

-R,--rootCHROOT_DIR

在应用更改CHROOT_DIR目录,并从使用配置文件CHROOT_DIR目录。另请参阅chroot。

构造

/etc/login.defs中的以下配置变量更改了此工具的行为:

MAX_MEMBERS_PER_GROUP(数字)

每个组条目的最大成员数。当达到最大值时,将在/ etc / group中启动一个新的组条目(行)(具有相同的名称,相同的密码和相同的GID)。

默认值为0,表示组中的成员数量没有限制。

此功能(拆分组)允许限制组文件中的行长。确保NIS组的行不超过1024个字符非常有用。

如果您需要强制执行此限制,则可以使用25。

注意:并非所有工具都支持拆分组(即使在Shadow工具套件中也是如此)。除非确实需要,否则不应使用此变量。

退出值

groupmod命令以以下值退出:

0

成功

2

无效的命令语法

3

选项的无效参数

4

指定的组不存在

6

指定的组不存在

9

组名已被使用

10

无法更新群组档案

groupmod [options] GROUP
Options

-g, --gidGID

The group ID of the givenGROUPwill be changed to GID.

The value of GID must be a non-negativedecimalinteger. This value must be unique, unless the-ooption is used.

Users who use the group as primary group will be updated to keep the group as their primary group.

Any files that have the old group ID and must continue to belong toGROUP, must have their group ID changed manually.

No checks will be performed with regard to the GID_MIN, GID_MAX, SYS_GID_MIN, or SYS_GID_MAX from/etc/login.defs.

-h,--help

Display help message and exit.

-n,--new-nameNEW_GROUP

The name of the group will be changed fromGROUPtoNEW_GROUP.

-o,--non-unique

When used with the-goption, allow to change the group GID to a non-unique value.

-p,--passwordPASSWORD

Theencryptedpassword, as returned by crypt.

Note:This option is not recommended because the password (or encrypted password) will be visible by users listing the processes.

You should make sure the password respects the system's password policy.

-R,--rootCHROOT_DIR

Apply changes in theCHROOT_DIRdirectory and use the configuration files from theCHROOT_DIRdirectory. See alsochroot.

Configuration

The following configuration variables in/etc/login.defschange the behavior of this tool:

MAX_MEMBERS_PER_GROUP(number)

Maximum members per group entry. When the maximum is reached, a new group entry (line) is started in/etc/group(with the same name, same password, and same GID).

The default value is0, meaning that there are no limits in the number of members in a group.

This feature (split group) permits to limit the length of lines in the group file. This is useful to make sure that lines for NIS groups are not larger than 1024characters.

If you need to enforce such limit, you can use25.

Note:split groups may not be supported by all tools (even in the Shadow toolsuite). You should not use this variable unless you really need it.

Exit Values

The groupmod command exits with the following values:

0

success

2

invalid command syntax

3

invalid argument to option

4

specified group doesn't exist

6

specified group doesn't exist

9

group name already in use

10

can't update group file

查看英文版

查看中文版

groupmod 语法

groupmod -n bettergroup newgroup

在上面的示例中,groupmod命令会将组“newgroup”更改为“Bettergroup”。

groupmod -n bettergroup newgroup

In the above example, thegroupmodcommand would change the group "newgroup" to "bettergroup".

查看英文版

查看中文版