I present to you a compilation of the most useful Linux commands for User and Group Management
Users
Create a new user
Creates a basic user on the system.
useradd usuarioCreate user with full option
Allows specifying additional information such as name, group, home directory, and shell.
useradd -c "User Name" -g group -d /home/user -s /bin/bash usuarioDelete user
Removes a user from the system.
userdel usuarioDelete user and remove their home directory
Removes a user and their associated personal directory.
userdel -r usuarioChange user attributes
Modifies the information of an existing user.
usermod -c "User name" -g group -d /home/user -s /bin/bash usuarioChange the password of the user themselves
Allows the user to change their own password.
passwdChange the password of another user
Allows the root user to change the password of another user.
passwd usuarioSet an expiration date for the user password
Establishes a specific date when the user password will no longer be valid.
chage -E 2014-12-31 usuarioView information about the user
Displays details about the user, such as groups they belong to.
id usuarioList users
Displays all users on the system.
cat /etc/passwdUser Groups
Create user group
Creates a new group on the system.
groupadd group_nameDelete user group
Removes a group from the system.
groupdel group_nameRename user group
Changes the name of an existing group.
groupmod -n new_name old_nameModify the current group of a user
Changes the active group of the current user who belongs to multiple groups.
newgrp groupList groups of the current user
Displays the groups to which the current user belongs.
groupsList all groups
Displays all groups defined on the system.
cut -d: -f1 /etc/groupAdd user to an existing group
Adds a user to a specific group.
usermod -aG group_name usuarioRemove user from a group
Removes a user from a specific group.
gpasswd -d usuario group_name