Introduction#
Creating a separate user account on Ubuntu is a good way to improve security and keep administration tasks organised. In this guide, we’ll create a new user, set a password, and optionally give the account sudo access.
Create a New User#
Use the adduser command, replacing newusername with the name you want to use:
sudo adduser newusername
Ubuntu will then prompt you to:
- create a password for the new account,
- confirm the password, and
- optionally enter extra details such as the full name and phone number.
If you don’t want to fill in the extra details, you can simply press Enter to skip them.
Confirm the User Was Created#
To verify that the account now exists, run:
id newusername
If the user has been created successfully, Ubuntu will display the user ID (uid) and group information.
Give the User Sudo Access (Optional)#
If the new account needs administrator privileges, add it to the sudo group:
sudo usermod -aG sudo newusername
This allows the user to run administrative commands with sudo.
Only grant sudo access to accounts that actually need it.
Switch to the New User#
To test the new account, switch to it with:
su - newusername
If everything is working correctly, your shell prompt will change to the new user.
You can also confirm whether the user has sudo access by running:
sudo whoami
If configured correctly, the output should be:
root
Conclusion#
You now know how to create a new user on Ubuntu and optionally grant it sudo privileges. This is a basic but essential task for managing servers and desktop systems safely.