Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member sehh's Avatar
    Join Date
    Feb 2006
    Location
    Europe
    Posts
    461

    Default Limit php to users home dir

    How can i force php to only access files within the users home directory?

    I'm using apache 1.3.x and php v4 and v5 together in cPanel v11 STABLE.

    I want this feature so that a user can't install a php file manager and browse the system remotely.

    Thank you.

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by sehh View Post
    How can i force php to only access files within the users home directory?

    I'm using apache 1.3.x and php v4 and v5 together in cPanel v11 STABLE.

    I want this feature so that a user can't install a php file manager and browse the system remotely.

    Thank you.
    You may want to change the setting for open_basedir in php.ini for both PHP 4 and 5 to try to curb the ability to browse folders outside /home/user.

    Additionally, if security is a concern, you may wish to run SuPHP (now supported in EA3, simply select it on the "Advanced Configuration" screen). You may also consider running Suhosin.

  3. #3
    Member
    Join Date
    Sep 2004
    Location
    inside a catfish
    Posts
    963
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by sehh View Post
    How can i force php to only access files within the users home directory?

    I'm using apache 1.3.x and php v4 and v5 together in cPanel v11 STABLE.

    I want this feature so that a user can't install a php file manager and browse the system remotely.

    Thank you.
    First, let me suggest that you run suPHP if you do not already.

    Second, I believe the open_basedir directive is what prevents users from accessing outside of their web root, but I dont understand it fully and there may still be ways around that.

    Third, when you build apache, checkmark:

    Fileprotect (in EasyApache3)
    Prevent Users from reading other webroots (in EA2/EA1)

    Mike

  4. #4
    Member sehh's Avatar
    Join Date
    Feb 2006
    Location
    Europe
    Posts
    461

    Default

    Thank you both for your answers, i believe my system is using suexec, as i see the php scripts in the process list starting with "/usr/local/apache/bin/suexec", but i don't know if suexec has its own configuration.

    So based on the fact that i'm running suexec, is "open_basedir" enough to stop php scripts from browsing around?

    PS:
    i'd like to avoid running EasyApache to recompile it, since the current apache binary is running fine without problems for a year or so.

  5. #5
    Member sehh's Avatar
    Join Date
    Feb 2006
    Location
    Europe
    Posts
    461

    Default

    hmm google pointed me to a page in WHM that does just that:

    under "Security Center", select option "Tweak php open_basedir Security"

    running suexec along with open_basedir tweak, is that enough?

  6. #6
    Member
    Join Date
    Sep 2004
    Location
    inside a catfish
    Posts
    963
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by sehh View Post
    hmm google pointed me to a page in WHM that does just that:

    under "Security Center", select option "Tweak php open_basedir Security"

    running suexec along with open_basedir tweak, is that enough?
    You can never be secure enough. Do everything you can to secure it. You shouldn't look to Cpanel or anybody else to give you a 'thumbs up', seriously. Nobody else can vouch for the security of your system or guarantee that somehow, some way, somebody can't gain access to information across sites, directories, etc.

    Suexec/SuPHP, open_basedir, mod_security, making sure Apache is compiled with options mentioned in previous posts, will go a long way.

    Add to that disabling ALL shell access, possibly running Suhosin if you are able to do it without breaking all of your sites / module functionality.

    Mike

  7. #7
    Member sehh's Avatar
    Join Date
    Feb 2006
    Location
    Europe
    Posts
    461

    Default

    thank you for your suggestions

    i don't want to make any major changes, because next week stage 2 will hit the door for STABLE release and i don't want to break anything. Once stage 2 is complete and Apache 2.x is running, i'll go for a custom recompile and remove anything i don't need (like frontpage extensions).

Similar Threads & Tags
Similar threads

  1. Lock users into their /home dir
    By nurvox in forum New User Questions
    Replies: 12
    Last Post: 06-03-2007, 07:31 AM
  2. PHP5 not detecting php.ini in user's home dir
    By a_raims in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 10-06-2006, 02:14 AM
  3. users in dir other than /home
    By mgdoyle in forum cPanel and WHM Discussions
    Replies: 21
    Last Post: 08-11-2005, 08:16 AM
  4. How i change either a cpanel users Home dir or there public_html path to /shoutcast
    By ste@kmh-hosting in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 06-13-2005, 08:28 AM
  5. Replies: 7
    Last Post: 04-15-2005, 09:56 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube