Linux User and Group Management: A Comprehensive Guide
The essential commands for creating, modifying, and deleting user accounts, as well as managing user privileges and groups.
User Management: #
-
Creating a new user:
Set the user’s home directory and shell:
-
Setting a password for the user:
-
Deleting a user:
-
Modifying user properties:
-
Listing all users:
-
Changing to another user:
-
Granting sudo privileges:
Add the following line:
username ALL=(ALL:ALL) ALL -
Locking and unlocking user accounts:
Group Management: #
-
Creating a new group:
-
Adding a user to a group:
-
Removing a user from a group:
-
Listing all groups:
-
Modifying group properties:
Add or remove a user from a group:
-
Deleting a group:
-
Checking a user’s groups:
-
Changing the primary group of a user:
These commands provide a comprehensive overview of user and group management on a Linux system. Whether you’re creating new users, modifying user properties, managing groups, or adjusting user privileges, these commands will help you effectively administer your Linux environment.