How to add a root user on CentOS 8

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

Enjoying this content? Subscribe to the Channel!

Mastering CentOS: How to Add a New User and Grant Root (Sudo) Permissions on CentOS 8/7


Hi everyone, Darren O’Neill here from Darren’s Tech Tutorials!

In Linux server management, security is paramount. While it might be convenient to always log in as root, it’s best practice to use a standard user account and elevate your permissions only when necessary. This is where the powerful sudo command comes in.

In this quick, practical tutorial, we’re going to walk through the essential steps for setting up a new user on CentOS 8 (these steps also work perfectly on CentOS 7) and granting them full root privileges by adding them to the crucial wheel group.

By the end of this post, you will know exactly how to:

  1. Create a new user account.
  2. Set a secure password.
  3. Add the user to the wheel group for root access.

Ready to gain some control over your CentOS system? Let’s dive in!


Accessing Your Terminal

Whether you are logged in via SSH or accessing the system through the graphical user interface (GUI) terminal, the commands remain the same. Ensure you are running these initial commands as a user who already has sudo privileges (or as the root user).

Step 1: Adding the New User to CentOS

The first command we need is adduser. We will use sudo to execute this as the system administrator. In our video example, we are creating a user named ‘bill’. Remember to replace bill with your desired username.

Open your terminal and type:

sudo adduser bill

You will be prompted to enter your current administrator password to authorize the action. Once complete, your new user account has been created, but they cannot yet log in.

Step 2: Setting a Secure Password for the New User

A user without a password is a vulnerability! The next step is to immediately assign a strong password to the new account using the passwd command.

Type the following command, again using sudo:

sudo passwd bill

The system will prompt you to enter the new password twice. Choose a complex, secure password, as this account will soon have elevated privileges.

Step 3: Granting Root Power with the Wheel Group

This is the most critical step. On CentOS (and other RHEL-based distributions), the designated group for users who can execute sudo commands (i.e., temporary root access) is the wheel group.

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

The flags used are:

  • -a: Append the user to a supplementary group (don’t remove them from other groups).
  • -G: Specifies the group name.

Execute the following command:

sudo usermod -aG wheel bill

If the command executes silently, it means the user has been successfully added to the root-permission group!

Step 4: Testing Your New Sudo Permissions

Now that ‘bill’ is set up with root privileges, let’s verify that the access works as expected.

First, we will use the su (Switch User) command to log in as the new user:

su bill

You will be prompted for Bill’s new password. Once entered, your terminal session will be running as the user ‘bill’.

To test the root permissions, we will attempt to create a file in a location that only the root user normally has access to (like the / root directory) using sudo.

sudo touch test_file

The system will ask for the user ‘bill’s password one last time to confirm that ‘bill’ is allowed to execute the touch command as root.

If the command succeeds and you see the new test_file (or no error message), congratulations! Your user has been successfully configured and possesses full root power.


Wrapping Up

Managing users and permissions is foundational to robust Linux system administration. By following these four simple steps—adduser, passwd, and usermod -aG wheel—you have successfully created a secure, privileged account on your CentOS system.

I hope this tutorial was incredibly helpful! If you have any follow-up questions or run into any trouble, please drop a comment below—I’m always happy to help if I can.

Don’t forget to like this post and subscribe to Darren’s Tech Tutorials for more clear, actionable guides on mastering Linux and all things tech!

Happy commanding!