This article will explain how to create a sudo user on Ubuntu 18.04 Linux. First, we will look at creation of new sudo user using command line and later we will create a sudo user from Ubuntu’s graphical interface.
The sudo user can execute any command with administrative privileges, hence execute commands as root.
Operating System and Software Versions
- Operating System: – Ubuntu 18.04 Bionic Beaver
- Software: – Sudo version 1.8.21p2 or higher
Privileged access to your Ubuntu System as root or via
sudo command is required.
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of
- $ – requires given linux commands to be executed as a regular non-privileged user
Other Versions of this Tutorial
Create a sudo user using command line
To be able to create a sudo user we first need to create a regular user. To do so we can use
adduser command. Visit How to Add user on Ubuntu 18.04 for more information on how to create new users.
Let’s start by creating a new user called
lubos. Open up terminal and enter:
$ sudo adduser lubos
Next, we we need to add the new user to an existing
$ sudo usermod -aG sudo lubos
All done. We have just created a new sudo user
lubos. At this stage we are going to test new sudo privileges. Use
su command to login as the new user you have just created:
$ su lubos Password: To run a command as administrator (user "root"), use "sudo
". See "man sudo_root" for details.
sudo command we are now able to run any command with root privileges by prefixing the actual command with
sudo. We are also able to gain root prompt:
$ sudo -i [sudo] password for lubos: #
# character. This means we are now logged in as root. To confirm run:
# whoami root
The below video will summarize the entire sudo user creation process:
Create a sudo user using GUI
Using your graphical interface simplify sudo user creation on Ubuntu 18.04 desktop. We few click we are able to create user and at the same time assign the user sudo administrative privileges.
Consider a following example on how to create a sudo user on Ubuntu 18.04 Desktop: