I want to run an sh script from php. For this, i need to open visudo file:
sudo visudo
With this:
www-data ALL=(ALL) NOPASSWD: ALL
It works!
But I dont want to enable all command, just a specific sh script. So i changed it to:
www-data ALL=(ALL) NOPASSWD: /www/......./truncatefiles.sh
The path is correct, but shell_exec (from php) returns: sudo: no tty present and no askpass program specified And the command wont run. If the visudo line is same as my first example.
What can be the problem?