Objective
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
Requirements
Privileged access to your Ubuntu System as root or viasudo
command is required. Conventions
- # - requires given linux commands to be executed with root privileges either directly as a root user or by use of
sudo
command - $ - requires given linux commands to be executed as a regular non-privileged user
Other Versions of this Tutorial
Ubuntu 20.04 (Focal Fossa)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 useadduser
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 lubosNext, we we need to add the new user to an existing
sudo
group: $ sudo usermod -aG sudo lubosAll 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 "sudoUsing a". 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: #Note the
#
character. This means we are now logged in as root. To confirm run: # whoami rootThe below video will summarize the entire sudo user creation process:
Subscribe to RSS and NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.
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: