My command is
echo root_password | sudo -u root -S executable_full_path arguments
[sudo] password for www-data: Sorry,
As Álvaro suggested, I'm putting my comment as answer. Matt, this would make it possible to run that command as root.
@Matt, don't do that
/etc/sudoers (btw, you edit this file with the
visudo command, never directly). That way you are making possible that any
sudo whatever command run by your web application is run by root, possibiliting a lot of fun for an attacker if he founds a vulnerability in your application.
If you would like to run just ONE command as root without need for passwords, put this in
www-data ALL=(ALL) NOPASSWD: executable_full_path
Then you are only allowing to execute just this command as root. Now you should be able to do
sudo -u root executable_full_path arguments
without need to type in a password (and it will run as root). Also, this is the only command the user www-data may execute as root using sudo, so it should not be dangerous.