The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    1
    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:
    1
    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:
    14,472
    Likes Received:
    200
    Trophy Points:
    63
    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
     
  4. LeetsHost

    LeetsHost Member

    Joined:
    Apr 2, 2012
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    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:
    14,472
    Likes Received:
    200
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    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/metho...ricting-who-can-use-php-ini-files-167186.html

    Thanks!
     
Loading...

Share This Page