There are many reasons to create multiple user accounts on Ubuntu. For starters, each user gets to customize the settings to their preference while keeping their personal files separate. You also get to manage the level of privilege associated with each account.
Creating a user account from the terminal is a very simple task, but Ubuntu also lets you add users via the Settings app for those who prefer the GUI approach. You’ll need an account with sudo privileges for both methods.
Create a New User (CLI)
You can use the
useradd commands to create a new user account. Adduser conveniently automates the whole process by default (creating the user, group, adding the user to the group, creating the home directory, setting the password, and so on). Useradd lets you perform the exact steps you want manually.
adduser to create an account named Anup as an example. Remember to replace anup with your own username in the steps that follow.
sudo adduser anup
Input the password and additional user information. Once you’re done, you can verify that the account was created with
If you want to use
useradd instead, the syntax is similar. The only difference is you’ll also need to include the -m flag to create a home directory for the user.
sudo useradd -m anup
Once again, you can verify the result with
After verifying, set a password for the new user.
sudo passwd anup
And if you ever need to delete a user account, you can use the
deluser command as shown below.
sudo deluser anup
Granting Sudo Privileges
The primary group that a user belongs to is automatically created when adding the user account. But you can also add a user to additional groups afterward. For instance, admins commonly need to add or remove certain users from the sudo group.
The basic syntax for adding a user to a group is
sudo usermod -aG <group> <user>
In our case, we’ll add Anup to the sudo group with
sudo usermod -aG sudo anup
Like earlier, you can verify the change with
Alternatively, you can directly add a user to a specific group when creating the user. We’ll use the -G option to add anup to the sudo group as an example.
sudo useradd -mG sudo anup
Create a New User (GUI)
As stated, you can also perform the same tasks from the Settings app if you’d rather not use the terminal.
- Search and open ‘Users’ from the Applications menu.
- Click on Unlock from the top-right and enter your password to authorize further changes.
- Press the Add User button.
- Select the Account Type, fill in the user details, and press Add.
- After adding the new user, you can also modify the username and account settings if you want.