Wednesday, August 5, 2009

Simple Sudo on CentOS Linux (Part 1)

Sudo is generally considered a more secure way of controlling accessing to system commands. By default CentOS does not implement sudo by default


Note 1: To enable your userid to run any commands on CentOS,
# vim /etc/sudoers
youruserid ALL=(ALL) ALL (at /etc/sudoers)
(Youruserid can run any command)
#sudo -s (will prompt you for password before allowing you to have full admin rights)


Note 2: To enable users to use selected commands (at /etc/sudoers)
%users ALL=/sbin/mount/cdrecorder,/sbin/umount/cdrecorder


Note 3: Using the Cmnd_Alias at sudoers file
(Cmnd Alias helps to group a list of related commands)
youruserid ALL=(ALL) PROCESSES
$ sudo -l (Will list all the commands that youruserid have access to)


Note 4: Using User_Alias
User_Alias ADMIN = user1, user2, user3
ADMIN ALL=ALL

No comments: