Hey folks,
I''m having some problems with FastCGI and executing system commands
under sudo. I''ve been running the app on Webrick locally so far, and
have had it running on lighttpd 1.3/FastCGI. It''s also running fine
on the staging server on Apache2/FastCGI and Lighttpd 1.3/FastCGI.
But now I need to switch to a more serious webserver on my Mac, so
the Apache 1.3/FastCGI combination seemed logical. I''m doing this for
upload progress support btw.
Ok, well the app needs to execute some system commands, and that''s
where it''s failing. I''ve given the www user a real login shell
(csh)
and if you open a login shell for www, all is normal and you can
execute those commands using sudo just fine. Open an irb session as
www, and you can still execute system commands.
However, from the FastCGI it goes insane:
`ls` => works fine
`sudo ls` => ""
`sudo ls 2>&1` => "sudo: ls: command not found"
`sudo /bin/ls` => works fine
So, for some reason the path seems screwed up or somethin''.
Let''s see:
`sudo echo $PATH` => /usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/
usr/bin:.
`echo $PATH` => same as above
But the path from a login shell for www is different:
[tigger:~] www% echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/
bin:/usr/X11R6/bin:/Library/WebServer/bin
I also tried:
`sudo /usr/bin/which ls` => "/bin/ls"
and a whole bunch of other commands, all the same as with ls, works
normally, but not from sudo. The line in sudoers is:
www ALL=(ALL) NOPASSWD: ALL
Also interesting is that if I let Apache run this as plain CGI, it
works without a problem.
--
Marten Veldthuis
http://www.standardbehaviour.com -- Personal
http://www.textdrive.com -- It-just-works hosting
http://www.strongspace.com -- Secure file storage