Create an Admin User on Ubuntu

Table of Contents

Admin users are also known as “SUDO users”

Admin users are power users, people that have the required knowledge and expertise to do administrative tasks, they are given “Super Users” privileges and that’s the reason why they are also known as SUDO users (Super User Do).

Step 1 - Add a new user

Creating a new user really is a very simple task because the Operating System has kind of a wizard that will guide you through all the process, use the command below to start the process. Basically, you’ll have to choose a name for the new user (in the example below “admin23”) and immediately after entering a new password for this user.

				
					adduser admin23
				
			

Feel free to use the command above, hover your cursor over the up right corner of the box to see the COPY option that allows You to quickly copy the code with a simple click.

Step 2 - Add User to Sudo Group

Once the new user has been created, the next step will be to include this user into one special system’s group called “sudo”, see command below:

				
					usermod -aG sudo admin23
				
			

Feel free to use the command above, hover your cursor over the up right corner of the box to see the COPY option that allows You to quickly copy the code with a simple click.

Step 3 - Switch users

In order to be able to test if the new user recently created “admin23” can execute privileged commands, we can switch users, from the current user to the brand new user.

Switching users will trigger the change of the prompt symbol, from the pound symbol (#) to the dollar sign ($), that indicate you are now acting as the super user root.

				
					su admin23
cd ~
				
			

Feel free to use the command above, hover your cursor over the up right corner of the box to see the COPY option that allows You to quickly copy the code with a simple click.

Step 4 - Test sudo access

A valid test would be for example to list the files inside the home folder of the user root, that simple command requires sudo access.

From now on, each and every time that the user “admin23” wants to execute a command using his/her privileged rights, then He/She must start by typing “sudo” before the command.

				
					sudo ls -la /root
				
			

Feel free to use the command above, hover your cursor over the up right corner of the box to see the COPY option that allows You to quickly copy the code with a simple click.

Where to go next?

Now that we have an admin user who can execute commands as He is the super user “root” the possibilities are so many, but let’s not forget our goal, to have a web server ready to be used, so our next step could perfectly be the installation of Apache and properly configuring our firewall.