Create a User with Sudo Permission on RHEL / CentOS
On RHEL / CentOS server, the wheel group is granted with sudo. We can give sudo access to an existing user too. In this topic, we’re going to learn how to create a user and give permission to the user.
Table of Contents
Create a New User
To create a user, we need to use the
useradd command like this:
Set User Password
To set user’s password, we need to run the
You’ll see the output like:
Changing password for user theusername. New password: Retype new password: passwd: all authentication tokens updated successfully.
Provide Sudo Permission
We need to add the user to the
usermod -aG wheel theusername
The user theusername has sudo permission now.
Test Sudo User
First, we need to switch to the newly created sudo user:
su - theusername
Now let’s run a sudo command:
# stucture sudo [anycommand] # example sudo php -v
The first time, you’ll be asked to provide the user’s password.
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for theusername:
The article is over. Thanks for reading. ?
Preview may take a few seconds to load.
Below you will find some common used markdown syntax. For a deeper dive in Markdown check out this Cheat Sheet
Bold & Italic
Bold **double asterisks**
Three back ticks and then enter your code blocks here.
# This is a Heading 1
## This is a Heading 2
### This is a Heading 3
> type a greater than sign and start typing your quote.
You can add links by adding text inside of  and the link inside of (), like so:
To add a numbered list you can simply start with a number and a ., like so:
1. The first item in my list
For an unordered list, you can add a dash -, like so:
- The start of my list
You can add images by selecting the image icon, which will upload and add an image to the editor, or you can manually add the image by adding an exclamation !, followed by the alt text inside of , and the image URL inside of (), like so:
To add a divider you can add three dashes or three asterisks:
--- or ***