Sudo in a cron job question

Tim Wunder tim
Mon May 17 11:44:37 PDT 2004


On Wednesday 19 February 2003 5:09 pm, someone claiming to be Kurt Wall wrote:
<snip>
> % I guess that just goes to show you that explicit should be used in
> % scripts...
>
> It's not the script per se that's the issue, but the path specified
> in /etc/sudoers. I'm pretty certain that if you had specifed
>
>     (ALL) NOPASSWD: checkinstall -*[A-z]*
>
> that it would have worked.
>

Hmmm... I don't think so.
I do not believe that cron jobs know anything about $PATH.  Llama's reply 
shoulda lit the fading spark in my brain, but it didn't. If a command is not 
found by sudo, you'll get prompted for a password, prior to any not found 
error. That's what I was getting, a password prompt from sudo. Try it... type 
'sudo shithead' at a command prompt, you'll be asked for a password (unless, 
of course, you happen to have an executable called shithead set up in your 
sudoers file). That's why my script worked from a command line, but not from 
cron.

I'd go thru the motions of testing, but I'm pretty sure I'm right. If you're 
really curious, you can test it :-)

Regards, 
Tim

-- 
RedHat Psyche 8.0, stock kernel, KDE 3.1.CVS, Xfree86 4.2.1
  7:00pm  up 2 days,  8:56,  1 user,  load average: 0.00, 0.00, 0.00
It's what you learn after you know it all that counts


More information about the Linux-users mailing list