To begin with, running httpd as root is a very bad idea.
a safe way to do this is to completely divide privileges between the web server user interface and the effector - one obvious way to do this is to start the server with root privileges, accepting only local connections that the user interface sends its requests (an easy way to do this via inetd / xinetd ), which means you donβt have to worry about all the complications associated with setting up the daemon process).
You will also need some kind of trust mechanism between the user interface and the effector - a common secret will be sufficient - so that other programs in the system cannot invoke the effector. Using a trust system based on outsourcing or asymmetric request-based encryption means you no longer need to worry about local communication restrictions.
Finally, you need a well-defined protocol through which the user interface and the effector interact.
This is much more complicated than using sudo, but more secure (for example, sudo allows users to execute certain files as another uid - you hope the file contains the correct program).
Setuid has the same drawbacks as sudo with added complication, which (in most cases), if it starts another program, then it will do it as the original uid.
NTN
FROM.
symcbean
source share