Running a single command/script as root user through Apache/PHP
Hello
I have a requirement to execute a python script as root user through the browser. I have a PHP web script which I want to shell out of and call a python script (The python script utilizes the selenium firefox web driver to capture automated screenshots). The python script needs to be run under the root environment. I know it's not recommended to give root access to www-data, but it is the only way I can see that this will work. The PHP call I am using is shell_exec, then I am trying to pipe a password through so it can be run as root: PHP Code:
Code:
www-data ALL=(ALL) NOPASSWD: executable_full_path Nb: I have the default visudo config for Ubuntu 10.04.01 LTS: Code:
# /etc/sudoers ns |
I have managed to get it working!
By editing the sudoers file, I have given www-data root permissions to run the python script: Code:
# User alias specification Cheers, ns |
All times are GMT -5. The time now is 04:08 AM. |