ObjectiveThis 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
RequirementsPrivileged access to your Ubuntu System as root or via
sudocommand 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 TutorialUbuntu 20.04 (Focal Fossa)
Create a sudo user using command lineTo be able to create a sudo user we first need to create a regular user. To do so we can use
addusercommand. 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 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
sucommand 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.
sudocommand 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:
Create a sudo user using GUIUsing 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: