RHEL 8 / Centos 8 Add new sudo user

This is a quick tutorial that will show you how to add a user with sudo privileges.

Instead of using root user, always disable root login and use the sudo user for login in and operating your server.

Step 1 – Add a new user called Joey

Add a new user named Joey . Replace Joey with your intended username.

adduser Joey

Set a password for Joey. You’ll be prompted to input and confirm a password. Ensure the password is strong by using a mixture of small , capital and special alphanumeric characters.

passwd Joey

Add new user to wheel group

Add the new user , Joey to the wheel group so that it can assume root privileges using the sudo command.

usermod -aG wheel Joey

Test the new user by login in as follows:

Switch to the new user you’ve created.

su - Joey

Add your password to login. Then run some sudo command eg:

sudo dnf update

Enter your password again, to use sudo commands. If it runs with no warnings or errors then you have anew sudo user.

That is how to create a new Sudo user in Centos 8 or RHEL 8

Leave a Comment