Executing a command as apache
Posted
by
Lord Loh.
on Server Fault
See other posts from Server Fault
or by Lord Loh.
Published on 2013-11-04T07:39:41Z
Indexed on
2013/11/04
9:59 UTC
Read the original article
Hit count: 212
This script keeps outputting a 1
. and I cannot understand why.
<?php
passthru("nohup sudo rndc reload sd.example.com",$op);
print_r($op);
?>
I have also tried the above code without the nohup
. I have the following line in my sudoers file
apache ALL = NOPASSWD: /usr/sbin/rndc reload sd.example.com
Just to test, temporally, I allowed apache a shell, logged in as apache by sudo su apache
and successfully managed to execute sudo rndc reload sd.example.com
.
I do not see any error message in my log files wither. What could I be possibly doing wrong? None of the similar threads have pointed me to anything that solved my problem or debug it.
© Server Fault or respective owner