Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SPOSTARBUST_Widget_Class has a deprecated constructor in /home2/cptech/public_html/wp-content/plugins/spostarbust/index.php on line 386

Deprecated: Function create_function() is deprecated in /home2/cptech/public_html/wp-content/plugins/spostarbust/index.php on line 611

Notice: The called constructor method for WP_Widget in SPOSTARBUST_Widget_Class is deprecated since version 4.3.0! Use
instead. in /home2/cptech/public_html/wp-includes/functions.php on line 4514
How to Install and Configure SUDO on a CentOS Server

How to Install and Configure SUDO on a CentOS Server

The most interesting aspect of Linux which makes it favorite for setting up multi user systems is the file permission and efficient user management. Because of this permissions and user management systems, it becomes almost impossible for normal users to gain root permissions or execute commands that is accessible only for root.

It is in this scenario the command sudo comes in action. Root user can define some users who can execute sets of or defined commands so that root can delegate its powers to other users.  It can range from just one command to full root privileges, and in some OS, there is no real root user , just users with full root permissions.  The install and configure steps are given below.


Normally sudo is bundled with the default distro, if not, we will be able to install SUDO by using the yum command

yum install sudo

Once sudo is installed (package name: sudo), you can configure it by running ‘visudo‘ as root.


The quick and dirty way to use sudo would be to add at the end of the sudoers file :

 user    ALL=(ALL)       ALL

where user is the name of the user.

A better usage allowing two users to have networking access in the server will be,

User_Alias NETADMINS = user1, user2
Cmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dhclient, /usr/bin/net, /sbin/iptables, /usr/bin/rfcomm, /usr/bin/wvdial, /sbin/iwconfig, /sbin/mii-tool


If a user have sudo permissions, he need to prefix ” sudo ” to any command he issues so that the sudo will check for the permissions, after authenticating the user by password.

examples  :-

sudo ping localhost
sudo ifconfig
sudo iptables -L

If you need to get root permisssions for some time, if you have the ALL permissions,  you need to use the -i flag

sudo -i


sudo -s

There is much more to be learned about sudo command and its capabilities. Good way to grab more about sudo command is to start with the man pages for sudo and sudoers. 

Close Menu