User Management in Linux: A Comprehensive Guide
Rafsan Anwar
Cybersecurity Analyst | System Engineer | SOC Expert | Purple Teamer | Threat Intelligence | Computer Forensics Expert | Cloud Admin | Python Tools Dev | Mentor | CEH | CCNA | CSA(SOC) | AWS SAP
Managing users in Linux is a fundamental aspect of system administration. Effective user management ensures that only authorized individuals can access the system and perform specific tasks, enhancing security and maintaining order in a multi-user environment. This tutorial will guide you through the essential concepts and commands for managing users in Linux.
Understanding User Types in Linux
User Management Files
Creating a New User
To create a new user, use the useradd command:
sudo adduser username
check/identify user
to check existence of user within a system
id username
Deleting a User
To delete a user, use the userdel command:
sudo userdel username
If you want to remove the user’s home directory along with the account:
sudo userdel -r username
Change user in Terminal
Change user while staying at terminal:
su username
Exit from self account:
exit
Change password
change password for self account:
passwd
Change password for another user:
sudo passwd username
Sudo user managing
Add a user into sudo group:
sudo usermod -aG sudo username
Remove a user from sudo group:
sudo gpasswd -d username sudo