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!

Disallow php.ini to be uploaded by users

Discussion in 'Security' started by LeetsHost, Apr 2, 2012.

  1. LeetsHost

    LeetsHost Member

    Joined:
    Apr 2, 2012
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    Hi
    Can someone tell me how can i prevent users uploading php.ini in there accounts. I found it can bypass my serversSafe mode. It can make my servers Safe mode from ON to OFF for that particular user only. Any idea how to stop users from doing that or stopping users to upload php.ini
    Thanks in advance :D ......
     
  2. LeetsHost

    LeetsHost Member

    Joined:
    Apr 2, 2012
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    If a user makes a file or uploads a file named php.ini at file manager or a shell, and adds the following code:
    Code:
    safe_mode=OFF
    
    disable_functions=NONE
    safe_mode_gid=OFF
    open_basedir=OFF
    It makes Safe Mode OFF / disable_functions=NONE / safe_mode_gid=OFF / open_basedir=OFF
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,479
    Likes Received:
    421
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Do not send users private messages for assistance like that. Especially me, I've got a trigger finger. :p
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. LeetsHost

    LeetsHost Member

    Joined:
    Apr 2, 2012
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    l0lx ,just need help as little urgent :/ ......
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,479
    Likes Received:
    421
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    If you are using suPHP, you can disable the ability to use individual php.ini files by editing this section in /opt/suphp/etc/suphp.conf file:

    Code:
    [phprc_paths]
    ;Uncommenting these will force all requests to that handler to use the php.ini
    ;in the specified directory regardless of suPHP_ConfigPath settings.
    ;application/x-httpd-php=/usr/local/lib/
    ;application/x-httpd-php4=/usr/local/php4/lib/
    ;application/x-httpd-php5=/usr/local/lib/
    Change to the following to disallow user-based php.ini files and force the global /usr/local/lib/php.ini file:

    Code:
    [phprc_paths]
    ;Uncommenting these will force all requests to that handler to use the php.ini
    ;in the specified directory regardless of suPHP_ConfigPath settings.
    application/x-httpd-php=/usr/local/lib/
    application/x-httpd-php4=/usr/local/php4/lib/
    application/x-httpd-php5=/usr/local/lib/
    After that, you would want to restart Apache.

    Please note that you will no longer have the ability for set accounts to have individual settings, so if any user needs to increase upload_max_filesize value, for example, that account won't be able to change it. There's a thread on how to allow some accounts to have different settings and still restrict all values from being changed under suPHP at this location:

    http://forums.cpanel.net/f185/methods-increase-security-suphp-restricting-who-can-use-php-ini-files-167186.html

    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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