How To Create a Sudo / Root User on CentOS 7

Published: December 1, 2025 (Updated: Dec 1, 2025)

Enjoying this content? Subscribe to the Channel!

Granting Root Power: How to Create a New Sudo User on CentOS 7 (The Wheel Group Method)


Hi there, and welcome back to Darren’s Tech Tutorials!

If you work in system administration or are just setting up your first CentOS server, you know that constantly using the root account is dangerous. Best practice dictates that you should work under a standard user account and elevate your privileges only when necessary using the sudo command.

In this quick, essential guide, we’re going to walk through the straightforward process of creating a brand new user on your CentOS 7 system and immediately granting them sudo access by adding them to the crucial wheel group. Let’s get started and secure your server!


Prerequisites

Before we begin, you must be logged into your CentOS 7 server using the root account or an existing user with sudo capabilities.


Step 1: Create Your New System User

The very first step is simple: creating the new user account that you will use for your administrative tasks. For this tutorial, we will use the example username darrinadmin.

We use the adduser command followed by the desired username:

adduser darrinadmin

If the command executes successfully, you will see no immediate output, which means the user account has been created!

Step 2: Set a Secure Password for the New User

A user without a password is useless (and unsecured!). Next, we need to set the login password for our new account using the passwd command.

A quick security note: While we might use a simple password for a quick tutorial setup, ensure that on any live system, you always choose a strong, complex password!

passwd darrinadmin

The system will then prompt you to enter the new password twice for confirmation.

Changing password for user darrinadmin.
New password: [Type your new password here]
Retype new password: [Confirm your new password here]

Step 3: Grant Sudo Privileges via the Wheel Group

This is the most important step! On CentOS and other Red Hat-based distributions, the wheel group is the designated group whose members are granted sudo permissions by default.

To add our new user (darrinadmin) to the wheel group, we use the usermod command:

usermod -aG wheel darrinadmin

Let’s break down those flags:

  • usermod: The utility used to modify user accounts.
  • -a: Append the user to the specified group (crucial—this prevents the user from being removed from other existing groups).
  • -G wheel: Specifies the supplementary group (wheel) to add the user to.

Once you execute this command, the user darrinadmin now has the power to run commands as sudo!

Step 4: Verify Your New Sudo User Access

Now that the permissions are set, let’s log in as the new user and confirm that the sudo access is working correctly.

First, we switch to our new account using the su (substitute user) command:

su - darrinadmin

Notice the hyphen (-) after su—this ensures you log in with the new user’s environment and home directory settings properly loaded.

Running the Test Command

To test the sudo functionality, we will run a simple command that requires root permissions, such as listing the contents of the root directory (/):

sudo ls /

When you run this for the first time, you will be prompted for the new user’s password (darrinadmin’s password, not the root password). You will also see a standard security warning:

[sudo] password for darrinadmin: 
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[Your output listing the root directory will appear here]

If the directory contents appear successfully after entering your password, congratulations—your new sudo user is fully functional!


Wrapping Up

You’ve successfully created a secure, powerful administrative user on your CentOS 7 server! By leveraging the wheel group, you can ensure that you only elevate permissions when absolutely required, significantly improving the security posture of your system.

Did you find this tutorial helpful? If you have any trouble following the steps or need help troubleshooting, be sure to comment below!

And for more clear, accessible tech guides just like this one, don’t forget to subscribe to Darren’s Tech Tutorials. Thanks for watching, and we’ll catch you in the next video!