groupadd
groupadd is a command line tool used in Unix-based operating systems to create a new group. It allows system administrators or privileged users to manage user groups on the system.
When executed, groupadd adds a new entry to the system's group database file (/etc/group). This entry includes the group name, group password, group ID, and a list of users who belong to the group.
The tool requires root privileges to execute, as only the root user can modify the system's group database.
By default, groupadd assigns the next available group ID (GID) to the newly created group. However, it is also possible to specify a custom GID using the -g flag.
Typically, groupadd is used in conjunction with the useradd command to create a new user and assign them to the newly created group.
To enhance security, groupadd allows the system administrator to assign a password to the group, which can later be used to authenticate users who want to join the group.
In addition to creating new groups, groupadd can also be used to modify existing group entries. For example, it can be used to change the group name, assign a different GID, or update the group's password.
To view the list of existing groups on a system, the administrator can execute the groups command or inspect the /etc/group file.
Any operation performed using groupadd is logged in the system's log files, allowing administrators to track changes made to the group database.
Overall, groupadd provides a simple and efficient way to create and manage user groups on Unix-based systems, facilitating user management and access control.
List of commands for groupadd:
-
groupadd:tldr:20fc3 groupadd: Create a new group with the specific groupid.$ sudo groupadd --gid ${id} ${group_name}try on your machineexplain this command
-
groupadd:tldr:93e97 groupadd: Create a new group.$ sudo groupadd ${group_name}try on your machineexplain this command
-
groupadd:tldr:d502f groupadd: Create a new system group.$ sudo groupadd --system ${group_name}try on your machineexplain this command