sfunk1x
26th August 2009, 20:37
All -
I have a script which needs to execute the following command:
sudo /etc/init.d/httpd graceful
In the sudoers file, I have commented out requiretty and added
apache sz2 = NOPASSWD: /etc/init.d/httpd graceful
Performing an su - apache -s /bin/bash, then executing "sudo /etc/init.d/httpd graceful" will execute. However, when I have the following command in a php script and execute from a browser:
<?
echo exec('sudo /etc/init.d/httpd graceful');
?>
it won't work.
The thing is, if I execute 'setenforce 0' to turn selinux off, it works. I've attempted to change security context on the init.d/httpd script to httpd_sys_content_t, and the same thing for the /usr/sbin/httpd file to no avail.
Any suggestions on how I can get this to execute?
I have a script which needs to execute the following command:
sudo /etc/init.d/httpd graceful
In the sudoers file, I have commented out requiretty and added
apache sz2 = NOPASSWD: /etc/init.d/httpd graceful
Performing an su - apache -s /bin/bash, then executing "sudo /etc/init.d/httpd graceful" will execute. However, when I have the following command in a php script and execute from a browser:
<?
echo exec('sudo /etc/init.d/httpd graceful');
?>
it won't work.
The thing is, if I execute 'setenforce 0' to turn selinux off, it works. I've attempted to change security context on the init.d/httpd script to httpd_sys_content_t, and the same thing for the /usr/sbin/httpd file to no avail.
Any suggestions on how I can get this to execute?