How to create a sudo user on CentOS

  1. Connect to the server with the root user:

 

$ ssh root@server_ip_address

 

  1. Enter the adduser command to add a new user to the system

 

$ adduser username

 

  1. Set a password for the user with the passwd command

 

$ passwd username

 

  1. Use the usermode command to assign the user to the wheel group

 

$ usermod -aG wheel username

 

By default, on CentOS, members of the wheel group have sudo privileges.