Introduction
As I continue my 30-Day Linux Challenge in preparation for the RHCSA exam. Today Iβm covering something every system admin must know user management in Linux.
Whether youβre onboarding a new team member, securing a system, or automating access control, creating and managing users is one of the most core tasks youβll perform.
In this article, Iβm walking you through the essentials: creating users, modifying them, assigning passwords and removing accounts safely; all using just the terminal.
Index
- Why User Management Matters
- Key Commands You Will Use
- Practical Examples
- Pro Tips
- Real World Use Cases
- RHCSA Relevance
- Quick Summary
π Why User Management Matters
- Keeps your system organized and secure
- Allows team collaboration with controlled access
- Prevents unauthorized access
- Critical in production environments, servers and cloud systems
π Key Commands You Will Use
Command | What It Does |
---|---|
useradd |
Creates a new user |
usermod |
Modifies an existing user |
passwd |
Sets or changes a user password |
userdel |
Deletes a user |
β Practical Examples
β€ 1. Creating a New User
sudo useradd CloudWhistler
Creates a user named CloudWhistler
.
β€ 2. Creating a User with a Home Directory
sudo useradd -m SanaCW
β€ 3. Setting a Password for a User
sudo passwd SanaCW
β€ 4. Adding a User to a Group
sudo usermod -aG CW SanaCW
β€ 5. Changing a Username
sudo usermod -l SanaRedHat SanaCW
β€ 6. Deleting a User
sudo userdel SanaRedHat
Add -r
to remove their home directory too:
sudo userdel -r SanaRedHat
In below image, I have executed all commands as mentioned in the above steps so it's easy to preview and run them one by one.
π§ Pro Tips
- Always use
-m
to ensure a home directory is created. - Use
id username
to verify user info. - Use
grep
in/etc/passwd
to view all user entries. - Never delete a user without checking file ownership or system dependencies.
π Real World Use Cases
β
Onboarding new developers: useradd
+ group assignments
β
Securing systems: passwd -l
to lock unused accounts
β
Organized access control: Set up team-based permissions using groups
β
Automation: User creation is part of CI/CD scripts and Ansible roles
π§ͺ RHCSA Relevance
You'll be expected to:
- Create users with home directories
- Add users to groups
- Set and change passwords
- Lock/unlock or delete users
Mastering these commands makes the exam (and real-world tasks) way easier!
β Quick Summary
User management is one of the most practical skills you'll use daily as a Linux professional.
Whether you're securing a production server or setting up a test environment, learning how to confidently create and manage users with these commands is a must-have foundation for your journey.
I'd love to hear your thoughts, insights or experiences with Linux. Feel free to share and join the conversation [ Connect with me on LinkedIn www.linkedin.com/in/techwithsana ]π
#30dayslinuxchallenge #redhat #networking #cloudcomputing #cloudenginner #cloudarchitect #cloud #RHCSA #RHCE #RHEL #WomeninTech #Technology
Top comments (0)