LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   apache php + suphp/suexec > totally lost (https://www.linuxquestions.org/questions/linux-general-1/apache-php-suphp-suexec-totally-lost-4175456943/)

techsaffie 04-05-2013 05:00 AM

apache php + suphp/suexec > totally lost
 
hi guys/girls

I have been reading all over the web for a decent method on how to run a script as a different user, but I'm totally lost now ...

My objective:
- Apache server (running as user apache) with php webpage > ok
- php webpage has to launch bash script (bash script has to be executed as different userX:groupY) > not ok
- I'm on red hat 6.4

I understand that I should get something like suexec or suphp and set the suuid bit on the script.

> However this raises my first question, at one point in time I was able to launch the script by suexec, but it would only execute as root.
I never managed to get it working under the userX:groupY
Is this normal?
> if somebody could help me out with this and also with the php part, cause my php knowledge is a bit light it seems, I would be very happy :)

httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Dec 5 2012 04:03:05

suexec -V
-D AP_DOC_ROOT="/var/www"
-D AP_GID_MIN=100
-D AP_HTTPD_USER="apache"
-D AP_LOG_EXEC="/var/log/httpd/suexec.log"
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=500
-D AP_USERDIR_SUFFIX="public_html"

/www/html>ls -l
-rwsr-xr-x 1 userX groupY 4807 Mar 5 14:51 runscript
-rw-r--r-- 1 userX groupY 151 Mar 5 14:51 runscript.c
-rwsr-xr-x 1 userX groupY 24 Mar 4 16:12 script.sh
-rw-r--r-- 1 root root 650 Apr 5 11:35 test.php


thx


All times are GMT -5. The time now is 07:50 PM.