Add a User on the Sudoers on CentOS 7

Windows Articles

How to install Android on a PC with Phoenix OS

Hello! Android is the most widely used mobile operating system in the world. Indeed, this Linux-based system has a large market share....

How to install Apache Maven on OpenSUSE 15.2 / 15.1?

In this post, we will show you how to install Apache Maven on OpenSUSE 15.2 / 15.1. To manage projects done in Java, there is...

How to install SQLite on OpenSUSE 15.2 / 15.1?

There are many good database management systems, but they are not all the same. And the fact that they are not, means...

How to detect port scanning and private IP access with Behave

Hello! Security when surfing the internet is a very serious issue. Consequently, the precautions we take are very important. Moreover, web browsers...

How to install LAMP on OpenSUSE 15.2 / 15.1?

It is increasingly common to find small companies that decide to use the SUSE ecosystem for their servers. It's an unsurprising decision because OpenSUSE...

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.

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!

More articles

1 COMMENT

  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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to install Android on a PC with Phoenix OS

Hello! Android is the most widely used mobile operating system in the world. Indeed, this Linux-based system has a large market share....

How to install Apache Maven on OpenSUSE 15.2 / 15.1?

In this post, we will show you how to install Apache Maven on OpenSUSE 15.2 / 15.1. To manage projects done in Java, there is...

How to install SQLite on OpenSUSE 15.2 / 15.1?

There are many good database management systems, but they are not all the same. And the fact that they are not, means...

How to detect port scanning and private IP access with Behave

Hello! Security when surfing the internet is a very serious issue. Consequently, the precautions we take are very important. Moreover, web browsers...

How to install LAMP on OpenSUSE 15.2 / 15.1?

It is increasingly common to find small companies that decide to use the SUSE ecosystem for their servers. It's an unsurprising decision because OpenSUSE...