Psychz - Maya
Votes: 0Posted On: Oct 08, 2017 23:07:10
When you want to grant Admin privileges to normal users. These privileges are only assigned to "root" users but there can be a situation when you want to give them to normal users as well. 'sudo' command provides a mechanism to do so.
The following steps show you how to add a user to sudo user.
Prerequisites
1. Operating System - CentOS 7
Step 1
Use the 'usermod' command to add the user to the 'wheel' group. By default, on CentOS, members of the wheel group have sudo privileges.
usermod
-aG wheel mercury (where 'mercury' is an existing user)
Step 2
Test the account for sudo access
Switch to the account you just assigned 'sudo' access to using 'su' command
su
- mercury
Now, verify that you can use sudo by prepending "sudo" to the command that you want to run with superuser privileges.
For example, you can list the contents of the /root directory, which is normally only accessible to the root user.
mercury$
sudo
ls -la /root
You will be prompted for the password of the user account if this is your first use of 'sudo' in a session. Enter the password to proceed.
Output
[sudo] password for username:
If your user is in the proper group and you entered the password correctly, the command that you issued with sudo should run with root privileges.