I am trying to grant php sudo access (for automated share mounting). I was sucess full at granting php sudo access on one of my systems by adding daemond to the list of sudo's via
su --login -c 'visudo'
so now it contains the daemond like:
daemon ALL=(ALL) NOPASSWD: ALL
but when I try to run a simple php script:
<?php
echo "\nfirst: ";
echo shell_exec("whoami");
echo "\nsecond: ";
echo shell_exec("sudo ls");
?>
I get the results:
first: daemon
second:
That is any time I us shell_exec with sudo in the command nothing is returned or excited. How can I grant php sudo access.
Check your web server error log... I bet you are getting an error like:
If this is the case, try modifying your sudoers file and change/remove the requiretty line:
On the other hand, if you are simply trying to automatically mount and share something, autofs/automount might be worth investigating.