I am kinda new with php. I am developing a web-interface for an application that sometimes needs root privs. Editting /etc/sudoers is not an option since the web interface needs to be portable to other users when they install my application. Is there any workaround ?
$command = "./script.sh /dev/$DISKNAME &";
$shellOutput = shell_exec($command);
sudo -u root -S ./a.out $DISK < /path/to/a/tmpfile/that/contains/root/password > check.log
check.log gets created. But the results of ./a.out dont show up in the log file. And the script works fine when run from the terminal. User doesnt have to enter password. But from PhP the log file is created and then the script exits with exit code 1. Is there anything i am doing wrong ? Anyone aware of how to achieve what I want to do ?
Any help would be highly appreciated.