1. Introduction
In this short tutorial, we will learn how to create a new user on Ubuntu with sudo privileges. With sudo, we could grant administrator privileges to not root users in Linux OS. This guide will show simple steps to create a new user and add them to sudo
group.
2. Steps to create a sudo user on Ubuntu
2.1. Log in to your local or remote server:
2.2. Use adduser
command to create new user
If you are not the root user use sudo
before adduser
command:
Replace username
with the user that you wish to create.
If you use sudo
command you will be prompted to provide the password.
Next, you will need to confirm the new user’s password at the prompt.
Next, fill all prompts with new users' information or leave all of these fields blank.
Confirm the correctness of the information you provided and we are almost there.
2.3. Finally, use the usermod
command to add the user to the sudo
group.
3. Test sudo
user
3.1. Switch to a new user using su
command
3.2. Now as a new user check if you could use sudo
to run commands with superuser privileges.
For example, you could list the root user directory.
3.3. If this is your first use of sudo
in a console session, you will be prompted for the password. Enter the password to proceed.
4. Conclusion
In this short tutorial, you learn how to create a new user on Ubuntu OS with sudo
. By default, members of the sudo group
have sudo
privileges, so all we need to do after creating a new user is to assign them to sudo
group.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}