Monday, January 02, 2006

Giving root access via sudo

Category: Linux Redhat9 Tips
I wrote this post using wbloggar. Thanks wbloggar..:)

In some cases we should give root aceess to regular user. For example, when you as administrator is sleeping in your home at night, one of on duty officer of your company call you, telling there is a problem. After a litle analizing, suppose you know the TCP server daemon you created is not working. It should be restated by root. What should you tell to the officer? Give your root password? I do not think so.

Sudo (Superuser Do) was there to overcome this kind of problem. With sudo, you can give root access to specific user to run specific programs.

There are 3 files of interest:
  • /etc/sudoers configuration file, containing the role of access.

  • visudo program, to edit sudoers file.

  • sudo program, to run program/script with root level access.

For example, you want to give acces to user regular_user to run /bin/program_required_root_aceess.
Edit /etc/sudoers and add lines below root ALL=(ALL) ALL:

[root@kedip]# visudo
...
root ALL=(ALL) ALL
regular_user ALL= /bin/program_required_root_aceess
...
Save the file. That's all!

Regular user will run sudo like this:

[regular_user@kedip]$ sudo /bin/program_required_root_aceess
Password: <- password of regular user
...
...

When user run sudo, sudo will send notification mail of this event to administrator.

This is only introduction. There is much more you can get. Read man sudoers.

See u..

0 Comments:

Post a Comment

<< Home