Bugzilla – Bug 51
sudo 1.6.3p7 and cron - Solaris 8 04/01 SPARC
Last modified: 2002-01-17 19:13:56 MST
I have setup a standard sudo installation (--prefix=/pkgs/sudo-1.6.3p7 was the only configure option - Sun Workshop 6update1 C Compiler - GNU make) and have a simple NOPASSWD: configuration for one user which works a treat on the command line. The script which the sudo is embedded in also works fine if run from the command line. But the sudo fails with return code 1 when the script is run from cron. Sudo being suid makes it impossible to truss as truss would need to be run as root to truss an suid execuatable, and there is not any info in syslog or in the mail sent from cron to suggest why the sudo is failing in this environment. Any Fix / Pointers or internal debugging options would be greatly appreciated to help track down the problem. Many Thanks in Advance Peter Backround: We have create a wrapper for "mtx" (tape changer) called L280 (after the Sun tape unit we have). Commands such as "sudo L280 load 5" work fine on the command line, and even in scripts run from ther command line. But this script "backupController" fails if run from cron. My guess is its a "no controlling terminal" issue. I have tried both sudo and sudo -S without success, remembering that the user has a single valid sudo-able command /pkgs/bin/L280 which has a working NOPASSWD: option prefixing it.
On another system (Solaris 8 04/01 via MU4 INTEL - my home system) 1.6.3p5 works fine under cron (as expected) - when I get time - I'll try the combinations and report back on the results
Are you sure that it is sudo that is exiting with a value of 1 and not the program you are running via sudo? Sudo prints an error message whenever it exits with an error and, in most cases, logs the error as well.
While I have not had achance to verifiy this - mtx's latest release is suppose to fix an issue related to cron use.