Add a sudo user On CentOS
To create a user and give them a sudo access you will need to have a sudo access. Follow the steps below to create new user and provide them sudo access
Login to the server with the choice of your tools
ssh root@yourserverIpAddress
Add a new User to the system and change your password
adduser test - Change test with the name of your choice
passwd test - change the password for the user you created above
Adding the new User to the wheel Group
usermod -aG wheel test - all member of the wheel group has a full sudo access and we are adding the new user to the wheel group
Test your Access
use the su command to switch form to root user to the newly created user
su - test - you are now logged in as the new user
now you can run /execute a sudo command
eg. sudo ls -la /root - enter the password for the new use and you should be good to go
Adding new group
add groups to the system
groupadd groupname
add user to group
usermod -a -G groupname test