On Sun, Dec 01, 2002 at 01:53:01PM +0530, mails@munshi.dyndns.org wrote:
Any clues where should I go next. All I need to do is execute some command as a superuser but from a PHP page.
A general search on google for "setuid php scripts apache" yielded this link. It mentions that "sudo" is the right way to run commands with root privileges, and also explains why your C program didn't work.
http://www.aota.net/forums/printthread.php?threadid=12453
"A file that is owned by root and is setuid root (chmod u+s filename) is *allowed* to function as root. It only becomes root when it calls the setuid function ( int setuid(uid_t uid) ). This is not available to interpreted shell scripts (I think there is a way to make Perl scripts setuid, but I haven't done it)."
HTH, Sameer.