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


ssh root@yourserverIpAddress

adduser test  -  Change test with the name of your choice

passwd test  - change the password for the user you created above

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

        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

groupadd groupname

    usermod -a -G groupname test