Sudo User on CentoOS featured image

Creating a Sudo-Enabled User on CentOS 8


If you are working with CentOS 8, you should know what are the critical commands to use with it. One of these is the sudo command. This command is very useful for creating new users. With the sudo command, you can grant certain users special administrative privileges. Typically, these privileges are only accessible to the root user. If you are making a regular user, you can use this command to give them special access without changing the /etc/sudoers file on the server.

This tutorial will help you understand how to use this command. We will detail the individual steps you need to take to create a new sudo-enabled user on CentOS 8.

How to Make a New User that is Sudo-Enabled?

Follow these steps to create a new sudo-enabled user on your server.os

1. Perform Server Login

First of all, you have to log into the server as the root user. Log in with the following:

Substitute in your own server’s IP address or hostname.

2. Add New User

Next, we will add a new user. For this purpose, we will use the adduser command. Let’s say we want to add a new user called sammy:

You can substitute sammy with your preferred username. The next step is to add the password for your user. Use the passwd command as follows:

The system will ask you to enter the new password two times for confirmation:

Sudo User image 1

Replace sammy with your chosen username.

3. The Wheel Group

Now we will add the user to the wheel group. If you want to give administrator privileges to an existing account, then you can skip to this step right away. We will use the usermod command to add the user to the group:

The reason why we are doing so is that all users in the wheel group have full sudo access and privileges.

4. Sudo Access

Lastly, you can check and confirm whether or not your new user has acquired the sudo permissions. To begin with, we shall switch from the root user to the new user using the su command:

Run the test by running sudo with the command you wish to use with your new permissions and privileges:

Let us assume that we want to list the contents of the /root directory. Normally, only the root user can visualize the contents of this file:

The system will require you to enter your account password if you are using sudo for the first time:

Sudo User image 2

Enter your password in the field to move forward. Remember, you need to enter the account password, not the root password. In case you are in the right wheel group with permissions enabled, the command will run successfully and show you the results. This is confirmation that you have received sudo with root privileges.


With the help of this tutorial, you can make a new account as well as grant it administrative privileges. The simplest route to take is to add it to the wheel group for sudo access.

Further, you can take a look at our other tutorials involving CentOS which you can find on our blog:

Happy Computing!