Grant sudo powers in RHEL/CentOS

Running as Root all the time is a dangerous tactic in a Unix based system, yet some commands can only be executed with superuser privileges. The sudo command allows a regular user to run selected commands with superuser privileges. This feature is included by default in Red Hat Enterprise Linux and CentOS systems, but it takes an extra step to get it working.

First you need to gain superuser privileges. Next, open the file located at /etc/sudoers. You need to locate the line that reads:

# %wheel ALL=(ALL) ALL

Now uncomment it by removing the hash mark (#) from the beginning of the line so it looks like this:

%wheel ALL=(ALL) ALL

Save a close the file. Now anyone who is a member of the wheel group will be able to use the sudocommand. To add a user to this group, gain superuser priviliges and run this command:

/usr/sbin/usermod -aG wheel [username]

This will add the specified user to the wheel group, allowing that user to use the sudo command.

QUoted from: http://blog.zloether.com/2009/05/grant-sudo-powers-in-rhelcentos.html

Leave a comment