Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the groupadd command on Linux system

2025-04-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the Linux system groupadd command how to use, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

The groupadd command in the Linux system is used to create a new workgroup, and the information for the new workgroup is added to the system file.

Groupadd [options] group

Create a new group. The Groupadd command creates a new group account using the value specified on the command line plus the system default. The new group will enter the system as needed.

(1)。 Option

If the specified group already exists, this option will be blind and exit only in a successful state. When used with-g and the specified GID_MIN already exists, select another unique GID (that is,-g off). This value must be unique, unless you use the-o option. But it must be non-negative. The default value is to use a minimum value greater than or equal to GID_MIN and greater than each other group. -Kmam Murkey KEY=VALUE overrides / etc/login.defs defaults (GID_MIN,GID_MAX and others). You can specify multiple K options. Example:-KGID_ MIN=100-KGID_MAX=499. Note:-K GID_MIN=10,GID_MAX=499 does not work. This option allows you to add a non-unique GID value. -pmam Murray password PASSWORD uses this encrypted password for the new group The password is disabled by default. Note: this option is not recommended because the password (or encrypted password) will be seen by the user through the listing process. You should ensure that the password complies with the password policy of the system. Create a system group for the rmaine Murphy system. The new system group numeric identifiers are selected in the SYS_GID_MIN to SYS_GID_MAX range and are defined in the login.defs instead of GID_MIN to GID_MAX. -Rmine Murray root CHROOT_DIR will apply the changes to the CHROOT_DIR directory and use the configuration. Show details

(2)。 Configuration file

There are the following configuration variables in / etc/login.defs that can be used to change the behavior of this tool:

The range of the group ID of the general group created by GID_MAX (number), GID_MIN (number) useradd,groupadd or newusers. The default GID_MIN (GID_MAX) value is 500 (60000). MAX_MEMBER_PER_GROUP (number) the maximum number of members per group entry. When the maximum is reached, start a new entry (line) at / etc/group (using the same name, password, and GID). The default value is 0, and there is no limit to the number of members in the group. This feature (split groups) allows you to limit the length of lines in the group file. This is useful for ensuring that the line ratio of the NISsan group is longer than 1024 characters. If you want to enforce this limit, you can use 25. Note: split groups may not be supported by all tools (even in the shadow toolset). You should not use this scalar unless you really need it. SYS_GID_MAX (number), the group ID range of the system group created by SYS_GID_MIN (number) useradd, groupadd, or newusers. The default SYS_GID_MIN (SYS_GID_MAX) value is 201 (- 1). (3)。 Related documents

/ etc/group group account information.

/ etc/gshadow security group account information.

/ etc/login.defs Shadow cipher suite configuration.

(4)。 Warning

The group name is up to 32 characters long.

You cannot add NISsan or LDAP groups, which must be performed on the appropriate server.

If the group name already exists in an external group database, such as NIS or LDAP, groupadd rejects the group creation request.

(5)。 Exit value

0 success 2 invalid command syntax 3 gave the option an invalid parameter 4 GID is not unique (no-o) 9 group name is not unique 10 cannot update group file (6). Example

Create a new group and add the group ID

# groupadd-g 344 cjh

At this point a project with group ID (GID) 344 is generated in the / etc/passwd file

Thank you for reading this article carefully. I hope the article "how to use groupadd commands in Linux system" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report