How to easily add and delete users on Ubuntu
Each person can have their own wallpaper, settings, and browser favorites. If any user stops using your PC, you should consider deleting that account as well. You can easily add or remove users on Ubuntu through the terminal by following the steps below.
How to add a new user account on Ubuntu
On Ubuntu PCs (and indeed on most Linux distributions), user accounts can have different levels of access and permissions. Each user gets a specific ID number called a user ID (or UID) and their own home directory where they can store their personal files.
Sometimes, you may need to add new users. This can be easily done from Terminal using the adduser command. You will need root access to do this - you can elevate the command with sudo. To add a new user account on Ubuntu, follow these steps.
1. Open a new terminal window.
2. Type sudo adduser user , replace user with the desired user name, and press Enter .
3. You will be prompted to create and verify a password for the new user - follow the on-screen instructions to do this.
4. Follow the prompts to fill in the new user's information. You can bypass this by pressing Enter for each prompt.
5. Once completed, the new user will be ready to use their account.
How to grant root access to users on Ubuntu
If you recently created a new user account and want to give it root-level access on your Ubuntu PC, you can do so using the usermod command. Giving a user root access on Ubuntu means adding that user to the sudo group , meaning they can elevate their commands to run as root.
Allowing users to run commands as sudo poses certain risks because they will be able to access any file or folder on your PC and make any changes they want to the system. your system. Only give users superuser permissions if you trust them - otherwise, let them have regular user access.
To grant root access to a user on Ubuntu, follow these steps.
- Open a new terminal window.
- In Terminal, type sudo usermod -aG sudo user , replace user with the correct username, and press Enter .
- To verify the user has been added to the sudo group, type groups user and press Enter , replacing user with the username. This will list that the user is currently a member of the sudo group .
How to delete user accounts on Ubuntu
If you want to delete your Ubuntu user account, you can use the deluser command (as long as you have root access with sudo). You can use this command to remove users and leave their home directory intact. Additionally, if you want to delete their files, you can also use it to delete their home directory.
To remove Ubuntu users, follow these steps.
1. Open a new terminal window.
2. Type sudo deluser user to delete the user account without deleting their home directory. Replace user with the correct username before you press Enter , and provide your password if prompted to do so.
3. If you also want to delete the user's home directory, type sudo deluser --remove-home user (replace user with the correct username) and press Enter .
4. Next, enter the user id (replace user with the correct username). If the command is successful and returns a value, the username still exists and you may need to repeat the process. If it fails with such a no user error message then the user account has been successfully deleted.
Manage access to your Ubuntu PC!
Using the steps above, you will be able to quickly manage access to your Ubuntu PC by adding and removing users as needed. Adding a new user account is simple, but if you decide to delete an account, make sure to back up any files from their user folder first - you may lose them in the process.
Be sure to control who has root-level administrative access, depending on who is planning to use your PC.
You should read it
- Add and delete users in the group easily on Ubuntu
- What's New in Ubuntu 21.10?
- Why is Ubuntu LTS preferred over regular distros?
- What's new in Ubuntu 18.04 LTS just released?
- How to prolong the life of Ubuntu 18.04 installation with Ubuntu Pro
- What is the difference between Ubuntu Desktop and Ubuntu Server?
- Ubuntu 21.04 users need to update the system ASAP
- 5 things to do after upgrading to Ubuntu 22.04 LTS
- 5 Reasons Ubuntu Cinnamon Is Better Than Other Ubuntu Versions
- 10 reasons to choose Ubuntu 12.10 instead of Windows 8
- 7 reasons to upgrade to Ubuntu 23.04
- How to Customize Ubuntu 23.04 to Look Like macOS
Maybe you are interested
US users can now access ChatGPT via 1-800-CHATGPT
How to Change the Default User Account Avatar in Windows
2 features users don't like in Photoshop Express photo editing application
Microsoft still recommends 15-year-old backup solution for Windows 11 and 10 users
Canonical Urges Ubuntu 20.04 LTS Users to Upgrade or Purchase Extended Support
Microsoft removes a barrier preventing users from updating to Windows 11 24H2