• Linux -- groupadd



    GROUPADD(8)                                                         系统管理命令                                                        GROUPADD(8)

    名称
           groupadd - 创建一个新组

    大纲
           groupadd [选项] group

    描述
           The groupadd command creates a new group account using the values specified on the command line plus the default values from the system. The
           new group will be entered into the system files as needed.

    选项
           groupadd 命令可以接受的选项有:

           -f, --force
               This option causes the command to simply exit with success status if the specified group already exists. When used with -g, and the
               specified GID already exists, another (unique) GID is chosen (i.e.  -g is turned off).

    #############

           -g, --gidGID
               The numerical value of the group's ID. This value must be unique, unless the -o option is used. The value must be non-negative. The
               default is to use the smallest ID value greater than or equal to GID_MIN and greater than every other group.

               See also the -r option and the GID_MAX description.

           -o, --non-unique
               此选项允许添加一个使用非唯一 GID 的组。

           -r, --system
               创建一个系统组。

               The numeric identifiers of new system groups are chosen in the SYS_GID_MIN-SYS_GID_MAX range, defined in login.defs, instead of
               GID_MIN-GID_MAX.

    ###############


           -K, --keyKEY=VALUE
               Overrides /etc/login.defs defaults (GID_MIN, GID_MAX and others). Multiple -K options can be specified.

               示例:-K GID_MIN=100-K GID_MAX=499

               注意:-K GID_MIN=10,GID_MAX=499 尚不能工作。

           -p, --passwordPASSWORD
               加密了的密码,就像 crypt(3) 的返回值。默认为禁用密码。

           -R, --rootCHROOT_DIR
               Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.


           -h, --help
               现实帮助信息并退出。






    配置文件
           在 /etc/login.defs 中有如下配置变量,可以用来更改此工具的行为:

           GID_MAX (number), GID_MIN (number)
               useradd,groupadd 或 newusers 创建的常规组的组 ID 的范围。

               GID_MIN 和 GID_MAX 的默认值分别是 1000 和 60000。

           MAX_MEMBERS_PER_GROUP (number)
               每个组条目的最大成员数。达到最大值时,在 /etc/group 开始一个新条目(行)(使用同样的名称,同样的密码,同样的 GID)。

               默认值是 0,意味着组中的成员数没有限制。

               此功能(分割组)允许限制组文件中的行长度。这对于确保 NIS 组的行比长于 1024 字符。

               如果要强制这个限制,可以使用 25。

               注意:分割组可能不受所有工具的支持(甚至在 Shadow 工具集中)。您不应该使用这个变量,除非真的需要。

           SYS_GID_MAX (number), SYS_GID_MIN (number)
               useradd、groupadd 或 newusers 创建的系统组的组 ID 的范围。

               SYS_GID_MIN 和 SYS_GID_MAX 的默认值分别是 101 和 GID_MIN-1。

    文件
           /etc/group
               组账户信息。

           /etc/gshadow
               安全组账户信息。
           /etc/login.defs
               Shadow 密码套件配置。

    CAVEATS
           It is usually recommended to only use groupnames that begin with a lower case letter or an underscore, followed by lower case letters,
           digits, underscores, or dashes. They can end with a dollar sign. In regular expression terms: [a-z_][a-z0-9_-]*[$]?

           On Debian, the only constraints are that groupnames must neither start with a dash ('-') nor plus ('+') nor tilde ('~') nor contain a colon
           (':'), a comma (','), or a whitespace (space:' ', end of line: ' ', tabulation: ' ', etc.).

           组名最长为 32 个字符。

           You may not add a NIS or LDAP group. This must be performed on the corresponding server.

           If the groupname already exists in an external group database such as NIS or LDAP, groupadd will deny the group creation request.

    退出值
           groupadd 可能以如下值退出:

           0
               成功

           2
               无效的命令语法

           3
               给了选项一个无效的参数

           4
               GID 不唯一 (没有使用 -o)

           9
               组名不唯一

           10
               无法更新组文件
    参见
           chfn(1), chsh(1), passwd(1), gpasswd(8), groupdel(8), groupmod(8), login.defs(5), useradd(8), userdel(8), usermod(8).

    shadow-utils 4.1.5.1                                                 2014-02-17                                                         GROUPADD(8)





  • 相关阅读:
    Ansible facts
    K8S基础概念
    Ansible CMDB
    Docker 核心技术与实现原理
    如何在 Centos7 中使用阿里云的yum源
    一篇文全面了解DevOps:从概念、关键问题、兴起到实现需求
    关于操作stream流
    service not available now, maybe disk full, CL: 0.95 CQ: 0.95 INDEX: 0.95, maybe your broker mach
    AOP的底层实现,动态代理和cglib代理
    模拟浏览器加载静态资源
  • 原文地址:https://www.cnblogs.com/IceSword-syy/p/3950175.html
Copyright © 2020-2023  润新知