On a cgi project I am working on, I need to run a shell script as root.  I
know this is dangerous, but it has to been done.

The c program looks like this:

#include <unistd.h>

void main()
 {
   execl("/bin/sh","perm","/home/phone/perm",NULL);
 }

with premissions:
-rwsr-x---   1 root     nobody        11350 Jul 31 14:36 perms*

and the shell script looks like this:

#!/bin/sh

chown -R user1 /home/bud/web/
chgrp -R user1 /home/bud/web
chmod 700 /home/bud/web

with permissions:
-r-x------   1 root     root         1659 Jul 31 14:29 perm*

but everything I execute it though a cgi script or though the command:

su nobody -c /home/bud/perms

It says that nobody can't change owns, group on those files.


Any ideas?  I am not a C programmer so you will have to be gentle with any
examples.


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs

Reply via email to