If I have a file that has owner and group set to root, and setuid:
sudo chown 0:0 /var/www/file.sh
sudo chmod 4777 /var/www/file.sh
What could possibly be keeping apache (www-data) from running the file as root? I can verify that everything works as I want it to if I add www-data as a sudoer, but that’s the stupid thing to do.
I am simply working on a web interface for LAN where I use PHP to run a shell script. PHP is using the exec function. Again, everything works if I add www-data as a sudoer.
Help me understand!