How to Install sudo on Linux CentOS 5.7 Server

Share this Article :

Sudo is a program or package for Unix or linux operating systems that allows users to run programs with the security privileges of another user. With sudo, linux system administrator is allow to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while logging the commands and arguments. In this post, i will show the quick steps on how to install sudo on CentOS 5.7. This steps may working on other version such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5 and CentOS 5.6.

[[email protected] ~]# yum install sudo -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.oscc.org.my
 * extras: mirror.oscc.org.my
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.oscc.org.my
base                                                                         | 1.1 kB     00:00
extras                                                                       | 2.1 kB     00:00
rpmforge                                                                     | 1.1 kB     00:00
updates                                                                      | 1.9 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package sudo.i386 0:1.7.2p1-13.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package             Arch                Version                          Repository           Size
====================================================================================================
Installing:
 sudo                i386                1.7.2p1-13.el5                   base                351 k

Transaction Summary
====================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 351 k
Downloading Packages:
sudo-1.7.2p1-13.el5.i386.rpm                                                 | 351 kB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : sudo                                                                         1/1

Installed:
  sudo.i386 0:1.7.2p1-13.el5

Complete!

sudo help command and options can be display using “sudo -h” command :

[[email protected] ~]# sudo -h
usage: sudo -h | -K | -k | -L | -V
usage: sudo -v [-AknS] [-p prompt]
usage: sudo -l[l] [-AknS] [-g groupname|#gid] [-p prompt] [-U username] [-u username|#uid] [-g
            groupname|#gid] [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C fd] [-g groupname|#gid] [-p prompt] [-u
            username|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] []
usage: sudo -e [-AknS] [-r role] [-t type] [-C fd] [-g groupname|#gid] [-p prompt] [-u
            username|#uid] file ...

The visudo command is a text editor that mimics the vi editor that is used to edit the /etc/sudoers configuration file.

[[email protected] ~]# visudo

or

[[email protected] ~]# vi /etc/sudoers

Leave a Reply