Running CGI as root

Ben Pfaff pfaffben@msu.edu
29 Mar 2000 12:36:56 -0500


Benjamin Minshall <bminsh@mudbucket.goeke.net> writes:

> I have written a simple CGI script that requires root permission
> to restart some daemons remotely; however, I can't get my script
> to run as root.

What language is it written in?  Shell scripts can't be setuid,
you know.

> The web server is running as nobody and the script permissions
> are -rws--x--x.

Do you realize that that's quite possibly a big fscking security
hole?  A setuid CGI should probably be executable only by the
owner and the group of the web server (which should probably be
used only by the web server, i.e., `www-data' or such).

> Is there something special I need to do to get the script to
> run as root?