How to Manage Users in Ubuntu
Here’s how you can manage users in Ubuntu.
Add a new user
To add a new user, log in to your Ubuntu system as sudo/root user. Open the terminal and type the following command:
sudo adduser username
Replace “username” with the name of the user you want to add. Ubuntu will prompt you to enter and verify the password for the new user. Ubuntu will also ask for additional details such as the full name, phone number, and other optional information.
Delete a user
To delete a user, you need to be logged in as a sudo/root user. To delete a user, open the terminal and type the following command:
sudo deluser username
Replace “username” with the name of the user you want to delete. Ubuntu will delete the user’s home directory as well.
Modify user details
To modify user details such as the full name, use the following command:
sudo usermod -c “New Full Name” username
Replace “New Full Name” with the new full name and “username” with the username you want to modify. You can also modify other user details such as password and home directory using the usermod command.
Change user password
To change the password for a particular user, use the following command:
sudo passwd username
Replace “username” with the name of the user whose password you want to modify. Ubuntu will prompt you to enter and verify the new password.
Manage user groups
In Ubuntu, users can belong to one or multiple groups that define their permissions to access the system resources. To manage user groups, use the following commands:
To add a user to a group:
sudo usermod -aG groupname username
Replace “groupname” with the name of the group to add the user and “username” with the name of the user.
To remove a user from a group:
sudo deluser username groupname
Replace “groupname” with the name of the group to remove the user and “username” with the name of the user.
Conclusion
Managing users in Ubuntu is an essential task for system administrators. Ubuntu provides several command-line tools to manage users, including adduser, deluser, passwd, usermod, and groupmod.