On Linux, the sudo command gives you the ultimate privilege to perform various administrative functions, despite your non-root access. However, to use sudo you need to have a superuser account on your system.

Since there are several Linux operating systems, better known as distributions, there are several ways to add a sudo user. Read on to learn more about how you can use Linux commands in different distributions to accomplish this simple but important task.

Adding a superuser on Ubuntu and Debian

Within Ubuntu and other Debian-based distributions, there are two prominent ways to add a sudo user. You can either do this through the terminal or use the graphical approach with the system settings.

1. The command line approach

To add a sudo user from the command line, you must first start the terminal. Then enter the following command:

sudo adduser username

…Where Username is the name of the new user you want to create.


This command creates a new user that you can add to the sudoers group. Again, there are several ways to add a user to the sudo group. The first way is to use the User mod Command.

sudo usermod -aG sudo username

…Where -a refers to Attach Function and G stands for group.

After adding the user to the sudo group, you need to check that the above command worked properly. Enter the following to verify:

Group username

If you are a power user who prefers to avoid multiple commands, you can create a new superuser directly with a single command:

sudo adduser username sudo

The verification process remains the same as before.

2. Using the graphical user interface

Before adding the user to the sudo group via the system settings, you must first create a new user via the command line. Then follow the steps below to continue:

  1. Go to the Applications menu and click on the user Opportunity. You will see a list of users including the newly created users.

    Add GUI users

  2. click on the Unlock Option followed by the root password. You can switch to a different user account by simply clicking on it.

    Add user via GUI

  3. Once you select it, you will see an option to convert the newly created user account to an administrator account. Turn on the button next to that Administrator Label, and the account will be added as a sudo account.

Related: How To Use Sudo Commands Without Password In Linux

Creating a new superuser on Arch Linux

Since the system does not create a sudo account by default on Arch Linux, the user will have to create one manually. The first step is to get root access through the see below Command.

see below

Enter the password for the root user followed by the following command:

pacman -Sy sudo

Once sudo is installed, create a new user.

useradd –create-home username

Use the passwd command to set up a password for the new user.

passwd username

Now it's time to add the newly created username to the Sudoers list. Use the User mod Command to achieve this.

usermod –append –groups bike username

You can check the sudoers file with the following command:


As soon as the / etc / sudoers When the file opens you will need to edit some user permission specifications that are at the end of the sudoers file. Find the following line in the text file:

#% rad ALL = (ALL) ALL


Edit bike group - Arch Linux

Remove that # Symbol in front of the %Wheel Line and save the changes. Press Ctrl + Off on the keyboard to save the file.

To verify that the user has been added successfully, you need to run the following command:

su username

The bash prompt changes to reflect the name of the new user. Enter the following to verify:

who am I

It should show the name of the current user. Enter the following to verify that the new user has sudo permissions:

sudo whoami

When the output shows root, then the current user has administrator access.

Adding a sudo account in CentOS

Given CentOS 'popularity, it would be a shame to miss the process of adding a sudo account in this distro. The process for adding a sudo account in CentOS is pretty similar to the process given above for Arch Linux, but with some fundamental changes.

Before you create a new user, you must log in as root. Use the see below Command:

see below

Now that you've logged in as the root user, it's time to create a new user, which we'll then add to the Sudoers list.

useradd -G-Rad username

Set the password for this new user using the passwd command.

passwd username

Now log in as a new user to check if you have sudo access. To do this, enter the following commands one after the other:

su username
sudo whoami


Check sudo access - CentOS

As soon as you press Enter after typing the first command, the system will prompt you for the password. Enter the new password to continue. The output of the above command is displayed rootwhich means the current user has root privileges.

How to add a superuser in Fedora

If you are using Fedora as your primary operating system, you can assign superuser privileges to a new user in a few simple steps.

To create a new user, use the adduser command as follows:

adduser username

Now set a password for the new user.

passwd username

Add this newly created user to the wheel Group with the User mod Command.

usermod -aG-Rad username

usermod command in Fedora

Open the sudoers file with the following command:


Now you need to edit some user permission specifications. Find the following line in the text file and uncomment the % rad ALL = (ALL) Line by removing the lb Character (#) before.

## Remove comment so members of the group wheel can execute any command
% rad ALL = (ALL) ALL

Visudo command - Fedora

Granting superuser privileges to new users

Depending on which distribution you are using, the process of creating new sudo users is more or less the same with some minor differences. The idea is to make sure that you can give root privileges to any new administrators using the distribution.

Not many Linux users know about this, but sudo and su are two different commands. Although both serve similar functions, they differ greatly in many ways.

Key in a lock

Sudo vs. su: which command should you use?

On Linux there are two commands to get superuser access: su and sudo. Which one you should use depends on the task at hand.

Continue reading

About the author

Wini Bhalla
(48 published articles)

Wini is a Delhi based writer with 2 years of writing experience. While writing, she was associated with digital marketing agencies and technical firms. She has written content on programming languages, cloud technology, AWS, machine learning, and much more. In her free time, she enjoys painting, spending time with her family and traveling to the mountains whenever possible.

By Wini Bhalla

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

Click here to subscribe