You are not logged in.

#1 2012-07-28 23:25:21

Ztjuh
Member
Registered: 2011-05-30
Posts: 58

[SOLVED] sudo from webserver

I'm trying to start a program from my webserver, I already got it working, but one of the commands is not executed. This is my suders file:

##
## User privilege specification
##
root ALL=(ALL) ALL
***** ALL=(ALL) NOPASSWD: ALL
http ALL=(css) NOPASSWD: /usr/bin/screen

This piece of code works:

<?php
system("sudo -u css /usr/bin/screen -dmS css /home/css/css/css/srcds_run -autoupdate -game cstrike +exec server.cfg +map de_nuke +maxplayers 12 +ip 192.168.0.150 +port 27015 &");
?>

And this one doesn't work:

<?php
system("sudo -u css /usr/bin/screen -dmS csgo /home/css/csgo/srcds_run -game csgo -console -usercon +game_type 0 +game_mode 0 +mapgroup mg_allclassic &");
?>

Output of auth.log

Jul 29 01:12:37 localhost sudo:     http : TTY=unknown ; PWD=/home/css/public_html/extended ; USER=css ; COMMAND=/usr/bin/screen -dmS csgo /home/css/csgo/srcds_run -game csgo -console -usercon +game_type 0 +game_mode 0 +mapgroup mg_allclassic

But it's not running, while the first one does run, what's wrong? I already tried adding /home/css/csgo/srcds_run to the sudoers file but it didn't work.

Last edited by Ztjuh (2012-08-04 13:38:50)

Offline

#2 2012-08-04 13:38:07

Ztjuh
Member
Registered: 2011-05-30
Posts: 58

Re: [SOLVED] sudo from webserver

Found the problem, I just had to change the working directory with the php function chdir() to the directory of where the executable is.

Offline

Board footer

Powered by FluxBB