Home Linux CentOS Creating a New Sudo User on CentOS 8, The Easy Way

Creating a New Sudo User on CentOS 8, The Easy Way

190
0
Centos 8
Centos 8

Most of Linux users are already familiar with the sudo command available from the terminal. The sudo command allows user able to run programs or commands with administrator privileges – usually can only be run by root user.

If you ever need to add a new sudo user within your CentOS 8, here’s how do it the right and easy way.

1. Login to your CentOS 8 server

Login to your server using ssh as root.

$ ssh [email protected]

Replace 202.189.91 with your server IP address. Don’t forget to enter your root password when asked.

2. Create new user & add it to wheel user group

To add a new user to CentOS you can use the adduser command. For example:

$ adduser node35

You can replace node35 with any username you want to create for this user. The next step is to change the password of the newly created user.

$ passwd node35

Again, replace node35 with the username you want to change its password. You’ll be asked to enter the new password twice.

If you want to add the user to a certain user group, you can use the usermod command. Since we’re going to give this user sudo access, we might as well add this user to the wheel group.

$ usermod -aG wheel node35

Why add it to wheel group? Well, in CentOS any users that are added to wheel group will automatically granted sudo access.

READ:  How To Install and Configure PHP 7.3 on CentOS 7

3. Trying it out

To see if sudo access are working for user node35 simply switch to user node35 using su - node35 command.

Then try this command to see if the user is already granted root access.

$ sudo whoami

The above command should display root as the output.

There you go, you just finish adding a new user and gave it sudo permission. It shouldn’t take more than a minute to do it, right?

LEAVE A REPLY

Please enter your comment!
Please enter your name here