Go to main content

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

退出打印视图

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

groupadd(8)

名称

groupadd - 在系统上添加(创建)新的组定义

用法概要

/usr/sbin/groupadd [-g gid [-o]] [-S repository]
     [-U user1[,user2..] ] group

描述

groupadd 命令通过将相应的条目添加到 filesldap 系统信息库中的组数据库,在系统上创建新的组定义。

管理员必须被授予 "User Management"(用户管理)权限配置文件或具有 solaris.group.manage 授权才能添加组。成功添加组后,随即会授予管理员修改和删除组的授权。请参见 groupmod(8)groupdel(8)。分配组和项目所需的授权可以在 group(5)project(5) 中找到。

选项

支持以下选项:

–g gid

为新组分配组 ID gid。此组 ID 必须为小于 /usr/include/sys/param.h 中定义的 MAXUID 的十进制非负整数。组 ID 缺省值为大于当前分配的最大编号的下一个可用(唯一)编号。例如,如果组编号 100105200 已分配给组,那么下一个缺省的组编号为 201。(组 IDs 0- 99 是 Oracle Solaris 为将来的应用程序所保留的值。)

–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]

将用户 user1user2 的列表添加到组。

操作数

支持下列操作数:

group

A string consisting of characters from the set of ASCII lower case alphabetic characters and numeric characters.A warning message is written if the string exceeds MAXGLEN-1, which is 32 characters in Oracle Solaris 11.4.group 字段必须至少包含一个字符;其接受小写字符或数字字符,或者两者的组合,并且不能包含冒号 (:) 或 换行符

退出状态

将返回以下退出值:

0

成功完成。

2

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

3

为选项提供的参数无效。

4

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

9

group 不唯一。

10

无法更新组数据库。

文件

  • /etc/group

  • /usr/include/userdefs.h

属性

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

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

另请参见

group(5)attributes(7)groupdel(8)groupmod(8)grpck(8)logins(8)pwck(8)useradd(8)userdel(8)usermod(8)

Managing User Accounts and User Environments in Oracle Solaris 11.4

Working With Oracle Solaris 11.4 Directory and Naming Services: LDAP

附注

groupadd 可将组定义添加到系统。如果使用网络名称服务通过其他条目补充本地 /etc/group 文件,那么 groupadd 会针对外部名称服务验证指定组名称和组 ID 的唯一性,并使用 files 系统信息库中的条目。组名应该限于可移植文件名字符:A-Z、a-z、0-9、'_'、'-' 和 '.'。

如果 group 条目中的字符数超过 2047,组维护命令(例如 groupdel(8)groupmod(8))将失败。