sudo + php = what?

anyone know a reason why i shouldnt use sudo to run system commands via a webserver? i have the sudoers file all written up to only allow certain commands to be run.

/sudo sandwich


This was a troll thread I hope.

nope. a serious question

What sort of commands are you running from a webserver that requires sudo?

well i run screen under a certain user. i dont want to use user www, so i made a user called gserver. so my php has to su into gserver and run some screen commands like shutdown or start.

Nah, you just need to create a bash script that runs inside your screen and loops forever with a sleep delay that checks if a file exists like /var/www/gsever_control/perform_shutdown.txt and then shuts the server down if it does.

Executing commands through PHP is never a good option.