More Ideas? Eventhandlers and SUDO

Brian Whitehead brian.whitehead at digitalevergreen.com
Mon Sep 23 23:29:57 CEST 2002


On Mon, 2002-09-23 at 16:00, twebster at daksoft.com wrote:
> 
> Does anybody else have any ideas as to what may be causing SUDO to fail in
> my event-handler scripts?
> 
> Basically, they work fine from the command as the Nagios user but when the
> event handerl execute 'sudo /etc/rc.d/init.d/sendmail restart' it fails on
> the stop command.  The start command will work but the stop command fails.
> 

Two things to think about.  First just because you gave the user access
to /etc/rc.d/init.d/sendmail doesn't mean they have access to anything
that is run within the script.  The next problem you may run into is
that the user may not have the correct PATH setup to give access to a
file without using the full path.  These things may be completely off. 
Also, the /etc/sudoers file can be very particular about the syntax. 
Your line should look like this
nagios	ALL = NOPASSWD: /etc/rc.d/init.d/sendmail

but depending on the need, you may consider doing something more like
nagios	ALL = NOPASSWD: /sbin/service

but again that use will have to have /sbin in their PATH.



-- 
Brian Whitehead - A+, LCP, RHCE
Systems Administrator
Direct: 816.512.9417
Mobile: 816.510.3996
mailto:brian.whitehead at digitalevergreen.com

Digital Evergreen
423 West 8th Street
Suite 410
Kansas City, MO 64105
Phone: 816.512.9399
http://www.digitalevergreen.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf




More information about the Users mailing list