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