Search code examples
phpraspberry-piraspbian

shell_exec() haven't the permission to reboot/shutdown raspberry pi


i try to use shell_exec() from my php web application the simple commandes by example "ls" works but with sudo not working:

shell_exec("sudo reboot");

this is the link :

http://192.168.1.8/controle/webshell.php?commande=sudo%20reboot

but the commande cannot be executed.

Any help ?


Solution

  • it works with this modification in /etc/sudoers :

    www-data ALL = NOPASSWD: /sbin/reboot, /sbin/halt