Linux User and Group Management
Posted on June 1, 2024 (Last modified on June 8, 2024) • 2 min read • 217 wordsExplore how to manage users and groups in Linux, including creating and deleting users, managing user permissions, and using sudo.
Managing users and groups is crucial for system security and administration. This guide covers creating and deleting users, managing user permissions, and using sudo
in Linux.
Use useradd
to create a new user.
sudo useradd username
Set the user password.
sudo passwd username
Use userdel
to delete a user.
sudo userdel username
Use groupadd
to create a new group.
sudo groupadd groupname
Use usermod
to add a user to a group.
sudo usermod -aG groupname username
Use groups
to view a user’s group memberships.
groups username
Use ls -l
to view file permissions.
ls -l filename
Use chown
to change file ownership.
sudo chown user:group filename
Use chmod
to change file permissions.
sudo chmod 755 filename
Edit the /etc/sudoers
file to grant sudo access.
sudo visudo
Use sudo
to execute commands with superuser privileges.
sudo command
Effective user and group management is vital for system security and administration. Practice creating and deleting users, managing permissions, and using sudo
to enhance your Linux administration skills.