Quantcast
Channel: Admins Goodies » php
Viewing all articles
Browse latest Browse all 11

Running drupal as root in order for it to run bash scripts

$
0
0

Question

I store a website on redhat and using drupal.
There is a button on the site that activates a php script and that php script use exec to activate bash script on the server.
Right now the script is not being run, i guess because of permission reason – the drupal user that runs the bash does not have root access to run the bash script.
How can i add the user as a root and test this ? and then to downgrade it to normal level.
So what i need to know – how to view current users, groups, and status, and changing them.

Is this recommended ? I am not linux expert.

Thanks.

Asked by ilansch

Answer

You don’t need to run your web server (like apache) as root to do this. You can instead allow sudo for the web server user without password. To do so, edit the sudoers file using:

$ sudo visudo

and insert a line like this:

www-data ALL=NOPASSWD: /path/to/your/script

The above line assumes the web server user name is www-data. You need to change it as appropriate.

Answered by Khaled

Viewing all articles
Browse latest Browse all 11

Trending Articles