Need to run a command, as root, from PHP
I am trying to make a web interface to run chmod commands as root. PHP is run as the apache user.
I thought I could create a shell script as root, set it as 555, and run it from apache - but it doesn't do anything. No errors, no output - nothing at all. Any idea how I can do this? I am trying not to use sudo, because then they'll be a plain-text version of my server password sitting on the server. Thanks |
even if the script is owned by root it is still executed by the apache user and still the apache user does not have the permission to change permissions of files that don't belong to him or are set to 0777 anyway...Could you create a group, "chown" the files to the group and make apache user member of that group? sth like that?
|
I wonder if there really is a need for running such an UI in the first place.
Maybe you're trying to find a workaround for things that should be solved differently. Care to comment on the need to run chmod commands in the first place? Quote:
Quote:
Quote:
|
Quote:
I made a program that does the chmoding: PHP Code:
Do I add something like this in the sudoers file?: apache ALL=NOPASSWD: /fix.bin I tried it, and then put this in my php script, and it still doesn't work: echo `sudo -u root -n /test.bin`; I'm not sure if the -n flag is right or not - I am trying to switch off the password prompt. |
Quote:
|
All times are GMT -5. The time now is 02:56 PM. |