How to Create a Sudo User on CentOS

Table of Contents

How to Create a Sudo User on CentOS




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 Debian,








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 CenOS instances and update your system.


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.





adduser testuser

Step 3: Set up the Sudo Group for the User and test it





Include the new user in the sudo group,

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

Step 4: Add the User to the Wheel Group and test it

usermod -aG wheel testuser

Edit Sudoers File Check the sudoers file with visudo.


It’s now time to test, 



su - testuser

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





Try VPSie for free today!

Share on