I sent this message once before, but my mail server was having problems and
don't know if the message hit the list or not.  If this is a second or
re-post my apolgises.



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 everytime I execute it though a web browser or though the command:

su nobody -c /home/bud/perms

It says that nobody can't change owner and group on those files.


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

Thanks,
Jack



-
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