What Is A SuperUser? How To Create A Root User In Linux

In Windows, Administrator has all the privileges, but in Linux, it is the Superuser or root that has all the access like all commands, directories, files, and resources.

In this article, we will learn what is a superuser and how to create a root user in Linux.

What Is A Superuser?

A superuser or root user in a Linux system is one of the most powerful users that has all the access like how an administration has all the access in Windows.

A root user also has the ability to assign root access to other users if needed. Ideally, the root user is the prime target of hackers to get into the Linux system as a root user has all the access.

By default, any Linux system will create a user named “Root” as soon as you install the operating system. We should disable the user ” Root” if you want to protect your Linux system from hacking.

How To Create A Root User In Linux

Before you remove the root user, you need to create a new user and give him the root access so that the new user can do all the day-to-day tasks.

When you create a new user and give him the root access, they can perform all the jobs that the root can perform. Giving root access is also called “Sudo(substitute user do)” access. When a new user with root access runs any command they have to use “Sudo” before every command.

For example, to connect using ssh they have to use the following command.

ssh [email protected]   //For root 
sudo [email protected]   // For users with Root access

To create a new user and give them the root access, you need to follow the below steps.

In this example, I have created a new user named ” rajib”. Please replace rajib with your own name or anything you like in the command.

1. Login To The Linux System With The Root User

To login to the Linux system using Root access, please run the following command.

ssh root@server-address

2. Create A New User Account

To create a new user, you need to run the “adduser” command.

sudo adduser rajib

The system will ask a set of questions. Answer those and you are all set.

create a root user in linux

3. Add The New User To The “Sudo” Group

Adding the new user to the Sudo group means, you are giving the root access to them. To add the user to the sudo group, please run the following command.

usermod -aG sudo rajib

4. Test The New User

To test the new user if they have got root access or not, please run the following command.

su - rajib
sudo ls -la /root

If you see the following screen, that means the new user has the root access.

create a root user in linux

5. Add A Public Key To The New user

Without a public key, you can not connect to your Linux system using the new user. For that, first of all, you need to create a .ssh folder. To do that, you can run the following command.

 mkdir ~/.ssh

Create the authorized_key file inside the .ssh folder and add the public key. Once pasted, please save the file.

sudo nano ~/.ssh/authorized_keys

6. Varify The New User’s Login

You can run the following command to connect to your Linux server using SSH protocol.

ssh rajib@server_address

That’s it. Now you have created a new user and given root access. If you want to know how to secure your Linux server, you can read the following article.


Rajib Is The Founder Of RiansTech. A Seasonal Blogger And A Full-Time Product Designer For Over Two Decades. A Technology Freak And Loves To Write About It. RiansTech Is A Online Home For Him Where He Documents His Experiences And Learnings So That Others Can Get Benefited From It.