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 usuario
Create 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 usuario
Delete user
Removes a user from the system.
userdel usuario
Delete user and remove their home directory
Removes a user and their associated personal directory.
userdel -r usuario
Change user attributes
Modifies the information of an existing user.
usermod -c "User name" -g group -d /home/user -s /bin/bash usuario
Change the password of the user themselves
Allows the user to change their own password.
passwd
Change the password of another user
Allows the root user to change the password of another user.
passwd usuario
Set 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 usuario
View information about the user
Displays details about the user, such as groups they belong to.
id usuario
List users
Displays all users on the system.
cat /etc/passwd
User Groups
Create user group
Creates a new group on the system.
groupadd group_name
Delete user group
Removes a group from the system.
groupdel group_name
Rename user group
Changes the name of an existing group.
groupmod -n new_name old_name
Modify the current group of a user
Changes the active group of the current user who belongs to multiple groups.
newgrp group
List groups of the current user
Displays the groups to which the current user belongs.
groups
List all groups
Displays all groups defined on the system.
cut -d: -f1 /etc/group
Add user to an existing group
Adds a user to a specific group.
usermod -aG group_name usuario
Remove user from a group
Removes a user from a specific group.
gpasswd -d usuario group_name