e Learning

How to Give User sudo Access in Linux Centos 7

In Linux sudo is a command use to run commands with administrative privileges. It is Like run as administrator in the Microsoft Windows Operating System. But sudo is not a command that every Linux user can run. In order to use sudo command user must be a member of the group called wheel group.

And if a user is not a member of a wheel group and tried to execute sudo Command, following error will Occur.

user is not in the sudoers file. This incident will be reported.

When a user executes a command with sudo, it will prompt and ask to type password before executing the command and the user must type their own password not the password of the root user.

To add user to wheel group and give sudo Access, Open Terminal and enter following command.

usermod -a -G wheel username

To View the List of users belongs to the wheel group, Run Following Command.

grep /etc/group

or

getent group | grep wheel

 

example

For example, We have a user called lannister in our Centos 7 server and lannister is going to be and Administrative user of the server, So as as Administrator of a Linux server he needs to able to run commands with sudo(Since we Don’t want to give him the root password). So This is how it is done.

usermod -a -G wheel lannister

How to Give User sudo Access in Linux Centos 7

So it is a very simple task, giving sudo privileges to a user. See you all again with more Linux Centos 7 Tutorials.