Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Execute PHP as a the User

Discussion in 'General Discussion' started by shaun, Mar 26, 2002.

  1. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    316
    Location:
    San Clemente, Ca
    Have a client who wants to execute php with his UID/GID anybody have info on how to do this. Also Nick do you plan on having php execute as the user in the future.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Brownie

    Brownie Well-Known Member

    Joined:
    Aug 10, 2001
    Messages:
    145
    Likes Received:
    0
    Trophy Points:
    316
    If you've got SuEXEC installed, just chmod the file to 755 and put a shebang at the top - should run PHP as that user :)

    #!/usr/bin/php
    &?php
    .......
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    316
    Location:
    San Clemente, Ca
    well the reason for running the script as the user is so that the script cannot be read by others mainly. 0750 should work if 0755 does... I hope, i'll try this out. Thanks.

    reason for 0750 is so that people cannot read a php file that has passwords in it for the people wondering.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. gordita

    gordita Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    316
    yes, running PHP as a CGI script would allow the script to be run under the users uid/guid since you are using SuExec, but if you want to run mod_php (or mod_perl) scripts under a specific UID/GID your best (only) plan is to create a seperate httpd instance for this user - this provides the strictest security although it does require some manual configuration and you probably don't want to create a ton of these individual user specific httpd processes.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice