Go to main content

手册页部分 8:系统管理命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

groupmod(8)

名称

groupmod - 修改系统上的组定义

用法概要

/usr/sbin/groupmod [-S repository] [-g gid [-o]] [-n name]
     [-U [+|-]user1[,user2]...] group

描述

groupmod 命令通过在系统信息库的组数据库中修改相应的条目来修改指定组的定义。

管理员可以修改对其具有 solaris.group.assign/groupname 形式的匹配授权的所有组。此授权自动分配给创建组的管理员。管理员必须具有 solaris.group.assign 授权才能修改其他所有组。

选项

支持以下选项:

–g gid

为组指定新的组 ID。此组 ID 必须是小于 MAXUID(在 <param.h> 中定义)的十进制非负整数。组 ID 缺省值为大于 99 的下一个可用(唯一)编号。(组 ID 0-99 是 Oracle Solaris 为将来的应用程序所保留的值。)

–n name

为组指定新的名称。The name argument is a string of no more than 32 bytes consisting of characters from the set of ASCII lower case alphabetic characters and numeric characters.如果未能满足这些限制,将会显示警告消息。未来的 Oracle Solaris 发行版可能会拒绝接受不满足这些要求的组字段。name 参数必须至少包含一个字符,并且不得包括冒号 (:) 或换行符 (\n)。

–o

允许 gid 重复(不唯一)。管理员必须具有 solaris.group.assign 授权才能使用此选项。

–S repository

The repository specifies which name service will be updated.有效的系统信息库包括 filesldap。缺省的系统信息库为 files。When the repository is files, the user names can be present in other name service repositories and can be assigned to a group in the files repository.When the repository is ldap, all the assignable attributes must be present in the ldap repository, and both the LDAP server and client must be configured with enableShadowUpdate.See ldapclient(8) for details.

–U [+|-]user1[,user2]

更新组的用户列表,如下所述:

  • 列表前面的前缀 + 将该列表添加到现有用户列表。

  • 列表前面的前缀 - 从现有用户列表中删除该列表中的各个用户。

  • 当列表前面没有前缀时,使用指定的新用户列表替换现有的用户列表。

操作数

支持下列操作数:

group

要修改的现有组名称。

退出状态

groupmod 实用程序退出时返回以下值之一:

0

成功。

2

无效的命令语法。显示 groupmod 命令的用法消息。

3

为选项提供的参数无效。

4

gid 不唯一(当未使用 –o 选项时)。

6

group 不存在。

9

name 已作为组名称存在。

10

无法更新 /etc/group 文件。

文件

/etc/group

组文件

属性

有关下列属性的说明,请参见 attributes(7)

属性类型
属性值
可用性
system/core-os

另请参见

group(5), attributes(7), groupadd(8), groupdel(8), logins(8), useradd(8), userdel(8), usermod(8)

附注

The groupmod utility modifies group definitions in the group database in the repository.If a network name service is being used to supplement the local /etc/group file with additional entries, groupmod verifies the uniqueness of a specified group name and group ID against the external name service and uses the entries in the files repository.组名应该限于可移植文件名字符:A-Z、a-z、0-9、'_'、'-' 和 '.'。

如果组条目(/etc/group 中的一行)超过 2047 个字符,那么 groupmod 将失败。