I'll go through what i am doing, so that it will become clearer.
I've got a 'master' server, and i've got several 'slave' servers.
These slave servers are gaming machines.
The master server has got some perl scripts that tell the slave server (via SOCKETS:INET and the Webserver script on the slave servers) to perform certain actions (like start/restart gaming servers).
So, for example.
On the main server, if i want to restart a remote game server, the main server will use Sockets INET to communicate with a port on the GAMING (Slave) server to tell it to restart.
The webserver on slave checks the key to make sure that just anyone is sending data, and then executes:
system('./home/username/control restart');
This restarts the game server.
However, the game server is now running as root, since webserver.cgi is running as root.
Since there are many 5 or 6 game servers per machine, i would like the game server to be run as it's owners username.
Is this possible.
The things that the webserver needs to do is quite lenghtly, so putting them all in sudoers will basically include everything , from adduser/userdel, reboot, cp to other directorys, mv etc etc. Therefore webserver.cgi needs to be run as root.
The only option i could think of at the moment, was to create another script with a 'listen' port in every users directory, and have that running as the user, and then the webserver contacts that script to perform the action. But that's very long winded :-(.
Surely there is another way?