23.9 C

Add a User on the Sudoers on CentOS 7

On CentOS, you get the very vibe of the corporate and server workspace where not all the users are allowed to have access to everywhere in the system. The only user with TRUE power is the “root” user holding the admin privilege to even manipulate data on the hardware-level!

For other users, they have to contact the “root” user to perform the tasks that require elevated privilege. In most of the Linux distros, you have the “sudo” command that allows that certain command to be run as an admin task.

However, on CentOS, even if you know the password of the “root” account, you still can’t perform “sudo” commands. CentOS protects the sudo access to only known users.

Today, we’ll be having a look at adding a user on the “Sudoers” list, essentially enabling the access to the “sudo” command.

- Advertisement -

Performing this action should only be allowed when it’s necessary. Otherwise, the system admin should do the job personally. If you’re a system admin, make sure that you understand what you’re about to do.

Optional steps

If the user account was created before, then don’t follow the following steps. In this section, we’ll be checking on adding a new user in the system.

At first, enter the “root” mode –

su -

Now, add a user in the system –

adduser <username>


Time to add a password for the user –

passwd <username>

Adding a user to the “sudoers”

Run the following command as the “root” –

usermod -aG wheel <username>

This command will add the specific user into the “wheel” group. By default, the users in this group will automatically have the access to the “sudo” command.

Switch to the new user –

su - <username>

Now, run any command using “sudo” –

Voila! Everything is working properly!

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


  1. Don’t like sudo. I won’t use it on any of my systems. Too easy for someone who doesn’t know what they’re doing to royally screw things up.


Please enter your comment!
Please enter your name here

Latest article