Saturday, May 18, 2024
HomeTutorialsHow to Add or Create sudo User in Linux System

How to Add or Create sudo User in Linux System [Quickstart]

The sudo is one of the most popular command-line programs used in Linux systems. It gives you the privilege to perform server administration as a non-root user. To use the sudo command, first, you have to know how to create a sudo user in Linux. After adding a sudo user, you will have access to all the commands associated with sudo.

Depending upon the operating system of the user, the procedure of installing sudo and adding a new user account with sudo access is slightly different. Most of the popular distros of Linux are going to be covered in this post. Stay tuned.

Adding or Creating sudo User in Linux System

In Linux systems, you can create a sudo user or can add an existing user to the sudoers list in various ways. You can do that from the terminal; also, you can do that from settings. Plenty of ways for you. Here in this post, we are going to cover all of them in detail. First, we shall see the procedure in detail for Ubuntu or Debian-based Distros.

1. Adding a sudo User in Ubuntu or Debian Based Systems

In an operating system running by Ubuntu or Debian, we have to follow the same steps to achieve our goal. There are several ways of achieving that. We see them below. The processes are pretty easy and straightforward. You can choose any of them according to your convenience.

Method 1. Addition of sudo User via the Terminal

At first, you have to create a whole new user using the adduser command.

sudo adduser ouruser

creating new user in Ubuntu

Now you have a whole new user that is ready to be added to the sudoers group. You have plenty of ways to add the new user to the sudo group via the terminal. Let us see the addition via the usermod command.

sudo usermod -aG sudo ouruser

-a in this syntax means the append operation and G mean the sudoers group. As we have added our new user to the sudoers group, now let us verify if that is done successfully.

groups ouruser

checking sudo access of new user in Ubuntu-how to add or create sudo user in Linux

We can also do these two steps within a single step. See the following syntax for that.

sudo adduser ouruser sudo

And verify that with the same procedure we have already done for the previous way.

Method 2. Addition of sudo User Via GUI

The whole thing can also be done graphically using the desktop environment provided by Linux. At first, use the adduser command just like the previous section to create a new user to work with. Now, from the applications menu, go to the Users option. Click on that. You can see both of your running users and the newly created user there.

add users to sudoers user menu

Hit the unlock option now.

add users to sudoers unlocking

Give your password in order to proceed.

add users to sudoers asking password

Now switch to the other user via tapping on that.

add users to sudoers two users-how to add or create sudo users in linux

You can see an option to make the newly created user an administrator in the account settings menu. Hit on that to end the process. The creation of a sudo user is done in an alternative way.

add users to sudoers setting admin

2. Creation of a sudo User on Arch Linux or Manjaro

In the case of Arch Linux, sudo is not installed in the base installation process. So you have to install it all by yourself. No worries! It is not a tough game. First, you have to get root access by writing.


Then press Enter. It requires the password to get root access. Give that and proceed. Now, Write the following syntax on the terminal.

pacman --sync sudo

downloading sudo in manjaro

Sudo will be installed automatically after that. After installation, you have to create a new user at first. Using the useradd operation is handy. If you want to add an existing sudo user, then start from this phase.

useradd --create-home UbuntuPIT

You can set the password for the user using the passwd tool.

passwd UbuntuPIT

Now add the newly created user to the wheel group. Use the usermod tool.

usermod --append --groups wheel UbuntuPIT

adding new user to wheel group in manjaro-how to add or create sudo user in linux

At this point, we have to edit the sudoers file to give our newly created user an administrative privilege.


Then check the wheel group in the sudoers file. You can find that in the “User privilege specification” section located at the bottom part of the sudoers file. From the beginning of the line, you have to remove the comment. After removing that, you will get something like this.

Uncomment to allow members of group wheel to execute any command

%wheel ALL=(ALL) ALL

Done? Okay! One more thing to do. Hit the ESC from your keyboard and then type “:wq” (obviously without the quotation marks) to save the file. Thus you can create a sudo user in Manjaro or Arch Linux.

Time to test how our attempt works!

At first, we have to switch to our newly created user. Type and execute the following command to do so.

su - UbuntuPIT

We are now acting as “UbuntuPIT”. But how to verify that?

Write this and hit enter.


It will show the name of the current user. But how to check its sudo access privilege?

To check that, write this:

sudo whoami

Then it will require your given password. Put the password at its place and proceed. You will get “root” as the answer from the system if everything goes well. In this way, you can create a sudo user in Manjaro or Arch Linux.

3. Adding a sudo User in RHEL or Rocky Linux

RHEL is a trendy and quite popular Linux distro. Like the previous ones, here we have to create a user first. Then you have to give sudo access to that user. To do so, first gain the root command-line access. Write and execute this:


Then give your previously set password to continue. After that, use the useradd tool to add a whole new user in the group named “wheel”.

useradd -G wheel UbuntuPIT

You can also set password security for the user.

passwd UbuntuPIT

Now log in to the new sudo user and check if everything has worked well.

su UbuntuPIT

Check for the sudo permissions by executing this on the Linux terminal.

sudo whoami

Hitting enter will ask for your password. Put your password at its place and proceed. If it gives “root” as your reply, then you have gained sudo access with “UbuntuPIT”.

4. How to Do That in Kali Linux?

In Kali Linux, the addition of a sudo user is quite easy. Just open the terminal and then write

useradd -m ouruser

creating a new user in Kali Linux

Here the -m creates ouruser’s home directory.

Then set a password for our new user.

passwd username

We have already created our new user and have set a password for that. Now time to add it to the sudoers group. Then the newly created user will get access to sudo actions.

usermod -a -G sudo ouruser

adding new user to sudoers gorup in Kali Linux

The -a here tells the terminal to add ouruser to the sudoers group. The destination of the addition is denoted by -G.

Which shell is the newly created user going to use? You have to specify that. Execute this:

chsh -s /bin/bash ouruser

Here the chsh command changes ouruser’s login shell.

You are done. Log in to your new account and enjoy sudo actions.

5. Doing the Same Job in Fedora

In the case of Fedora, you have to use the adduser command to create a new user.

adduser ouruser

Once it is created, set a password for that.

passwd ouruser

Now add this user to the wheel group by executing the following command.

usermod -aG wheel ouruser

adding new user to wheel group in Fedora-how to add or create sudo user in linux

Check the sudoers file with visudo tool. There see the wheel group.


The comment line should be removed if it is already disabled. The whole thing is going to look like this:

Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL

removing comment in Fedora

Like we saw in the case of Manjaro, the rest is quite the same. Hit ESC and then write “:wq”. Then Press Enter. You are all done.


So, we have tried to cover how you can create a sudo user in Linux. Also, you can add an existing user to the sudoers list. In this case, you just have to skip the creation part.

We have covered the process for several Linux distros. If you think anything more has to be discussed here, reply in the comment section and let us know. You can also share this post with your friends to let them know about this necessary process we often encounter. See ya!

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.


Please enter your comment!
Please enter your name here

You May Like It!

Trending Now