Aug 1, 2005, 5:26 AM
Post #3 of 3
Re: [davorg] Spawn script as a different user
[In reply to]
I'm not too concerned about the webserver, since it's not a public webserver, and requires a key to get it to do anything.
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:
This restarts the game server.
However, the game server is now 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.
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?