Understanding User Management on Linux Systems


Linux provides robust tools for managing users and groups from the command line. Understanding user management is essential for any system administrator. In this post, we cover all the basic commands used for creating, modifying, and deleting users and groups in Ubuntu Linux.
1. Creating Users
To create a user and set a home directory automatically:
Add user with a comment and specific shell:
2. Deleting Users
To delete the user along with their home directory:
3. Basic Group Management
Create a group:
Delete a group:
Add user to a group:
List groups of a user:
4. Modifying User Details
usermod Part 1 – Change username, move home directory
usermod Part 2 – Change login shell, lock/unlock
5. Whois Command
Displays user information:
Install it first if needed:
6. Change User Password
Change your own password:
7. chage Command (Password Expiration)
8. Hostname Command
View hostname:
Set a new hostname:
Summary of Key Commands
Task | Command Example |
Add user | sudo useradd -m username |
Delete user | sudo userdel -r username |
Create group | sudo groupadd groupname |
Add user to group | sudo usermod -aG group username |
Change password | sudo passwd username |
Set password policy | sudo chage -M 90 username |
View/change hostname | hostname , hostnamectl |
Conclusion
Mastering user management in Linux is crucial for effective system administration. Whether you're creating new accounts, setting security policies, or managing group memberships, the commands discussed here will equip you with essential tools to manage Ubuntu systems securely and efficiently.
Subscribe to my newsletter
Read articles from Rishabh Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
