Tutorials for centos 7
To create a new user that has sudo access, you’ll need to have access to the root account, however this is only for the initial creation process. Once you have access to the server using the root account, please move on to the following procedure.

Step 1:  Issue the adduser command to add a new user to your server
Code: Select all
adduser newusernamehere
Step 2:  Change the password for the new user
Code: Select all
passwd newusernamehere
Step 3:  Add the new user to the wheel group using the usermod command
Code: Select all
usermod -aG wheel newusernamehere
Step 4:  At this point you can test the new accounts privileges by switching to the new account
Code: Select all
su - newusernamehere
Step 5:  The new user should have sudo permissions which should allow you to execute any command with the word sudo prefixed before the command for example you can list the contents of the root directory like so
Code: Select all
sudo ls -alh /root
The first time that you use sudo in a session, you’ll be prompted for the password to complete the command. If you followed this guide and the password was entered correctly, you should now see the directory listing for the root user. Having and using a sudo user is an excellent security practice, as it ensures that you can still enjoy the benefits of having the root user’s privileges without some of the risks associated with using the root account all of the time.

Intel® Xeon 2.53GHz [...]