User management is a critical aspect of Linux administration. Each user in a Linux system has specific permissions, roles, and files associated with their account. Understanding how to manage users efficiently ensures system security and organized access control.
In Linux, users are divided into three main categories:
All user information is stored in the /etc/passwd file, while passwords are stored securely in /etc/shadow.
To create a new user, use the useradd or adduser command:
sudo useradd usernameAfter creating the user, set a password:
sudo passwd usernameThis ensures the account is ready for login.
If you need to change user details such as the home directory or shell, use:
sudo usermod -d /home/newpath usernameor
sudo usermod -s /bin/bash usernameTo lock or unlock an account:
sudo passwd -l username
sudo passwd -u usernameWhen a user account is no longer needed, remove it safely with:
sudo userdel usernameTo delete the user’s home directory and mail files as well:
sudo userdel -r usernameTo list all users:
cat /etc/passwd | cut -d: -f1For detailed information about a specific user:
id usernameEfficient user management in Linux ensures security and proper access control. By mastering commands like useradd, usermod, and userdel, administrators can create a secure and well-organized environment.
Imagine if you had a super-powered assistant who could automatically handle all the boring, repetitive…
Managing files efficiently is a core skill for anyone working in Linux, whether you're a…
Open ports act as communication endpoints between your Linux system and the outside world. Every…
Introduction In today’s cyber threat landscape, protecting endpoints such as computers, smartphones, and tablets from…
Introduction In today's fast-paced cybersecurity landscape, incident response is critical to protecting businesses from cyberattacks.…
Artificial Intelligence (AI) is changing how industries operate, automating processes, and driving new innovations. However,…