I have a web server under apache2 and php5. I want to shutdown a computer using web server but to shutdown the computer a current user should be 'root' user because command for the turning off of PC 'shuwdown -h now' should be executed under root user.
The php user is called 'www-data'.
I have such files
echo $(shutdown -h now);
If this script will be called the script 'shutdown.sh' should be executed.
echo exec ( 'shutdown.sh' );
The question:how to execute file 'shutdown.sh' as root user without password. Or maybe are another ways exist?