There are many questions on this topic, but my situation is quite strange.
I am trying to print out exec("sudo -u root whoami") in php. But it returns nothing.
I added %www-data ALL=(ALL:ALL) ALL via sudo visudo but no luck on what is happenning, no error, just not printing out anything.
Any suggestion?
Thanks in advance
NOPASSWDoption the sudoers file offers, you want to read about that in the documentation. But once more: this is a bad idea for security reasons.echo exec("sudo -u root whoami")works fine give or take requiring password.exec("sudo -u root whoami 2>&1")so that you'll see error messages.