How to Create a Sudo User on RedHat

Table of Contents

How to Create a Sudo User on RedHat

Sudo is a program that runs on Unix-like computer operating systems that enables users to execute programs under the privileges provided by another user, usually the superuser. Sudo refers to either “substitute user do” or “super user do” – either of which allows you to temporarily elevate your user account to have root privileges. This is not the same as “su”, which has a more permanent effect.







Our goal here is to walk you through setting up a sudo user on RedHat,








Step 1: Configure VPSie cloud server



  1. Sign in to your system or register a newly created one by logging in to your VPSie account. 
  2. Connect by SSH using the credentials we emailed you.
  3. Once you have logged into your RedHat instance and update your system.




Check if the box needs any updates,


# sudo yum updateinfo



Run the command if it is available,

# sudo dnf update





Step 2: Set Up a New User Account



Use the adduser command to create a new user account. A user named “testuser” will be created here. Add the user to the wheel group.  




# useradd -G wheel testuser




Protect your user account by adding password,


# passwd testuser
Changing password for user testuser. New password: Retype new password: passwd: all authentication tokens updated successfully.






Step 3: Test sudo



Check the sudoers file with visudo.


# visudo




It’s now time to test, 



# su - testuser
Last login: Sun Dec 12 16:36:57 EST 2021 on pts/0
[[email protected] ~]$

That’s all for now, I hope you’ve found this informative.








Try VPSie for free today!
Share on