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!

public_html - 0750 or 0755

Discussion in 'General Discussion' started by nzgeoff, Jan 25, 2010.

  1. nzgeoff

    nzgeoff Member

    Joined:
    Jan 23, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    51
    I have been having some permission errors with my new cpanel install and no sites seem to work unless I change the public_html folder to 755. When first setup they are all 750 and it seems strange that I would have to change the defaults.

    Anyone got any clues as to what is happening here?
     
  2. nzgeoff

    nzgeoff Member

    Joined:
    Jan 23, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    51
    When I do

    <?php system('whoami'); ?>

    It outputs 'nobody'. Shouldn't this be the username of this domains account?
     
  3. ModServ

    ModServ Well-Known Member

    Joined:
    Oct 17, 2006
    Messages:
    332
    Likes Received:
    5
    Trophy Points:
    168
    Location:
    Egypt
    cPanel Access Level:
    Root Administrator
    Try to execute these commands:
    chmod 711 /home
    /scripts/fixhome
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. nzgeoff

    nzgeoff Member

    Joined:
    Jan 23, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    51
    The fixhome script didnt output anything (if its meant to) and didnt appear to change anything. I still get the 403 when trying to access files.

    Is there a fix script for getting apache to run as the correct user when accessing files etc?
     
  5. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,544
    Likes Received:
    9
    Trophy Points:
    268
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    What is the configured PHP handler and is SuExec enabled or disabled?
    Code:
    # /usr/local/cpanel/bin/rebuild_phpconf --current
    PHP scripts will only run as the user in the virtual host if using SuPHP; likewise, for CGI scripts the same applies only if using SuExec.

    Switching the PHP handler to SuPHP and ensuring SuExec is enabled will accomplish the task.
    WHM: Main >> Service Configuration >> Apache Configuration >> PHP and SuExec Configuration
    Configuring PHP and suEXEC from the Command Line

    Additionally, I would check Apache error logs for specific information on why the difficulty is occurring; the following command will monitor for new log entries; this should be followed by attempting to reproduce the issue to see relevant log entries:
    Code:
    # tail -fvn0 /usr/local/apache/logs/*log
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. nzgeoff

    nzgeoff Member

    Joined:
    Jan 23, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    51
    I don't have SuPHP installed but I'm guessing that's half the problem here. I will install it tonight unless someone here recommends otherwise.

    Here is the output of the requested commands:

    root@lust [/]# /usr/local/cpanel/bin/rebuild_phpconf --current
    Available handlers: dso cgi none
    DEFAULT PHP: 5
    PHP4 SAPI: none
    PHP5 SAPI: dso
    SUEXEC: enabled

    root@lust [/]# tail -fvn0 /usr/local/apache/logs/*log
    [Tue Jan 26 18:46:10 2010] [crit] [client 125.239.237.***] (13)Permission denied: /home/***/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

    The .htaccess file mentioned above is owned by the domain user.
     
  7. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,544
    Likes Received:
    9
    Trophy Points:
    268
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    What is the output from "stat" for each directory level up to the .htaccess file involved?

    Example:
    Code:
    # stat /
    # stat /home/
    # stat /home/$username/
    # stat /home/$username/public_html/
    # stat /home/$username/public_html/.htaccess
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. nzgeoff

    nzgeoff Member

    Joined:
    Jan 23, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    51
    root@lust [/]# stat /
    File: `/'
    Size: 4096 Blocks: 16 IO Block: 4096 directory
    Device: 801h/2049d Inode: 2 Links: 26
    Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
    Access: 2010-01-26 12:32:15.000000000 +1300
    Modify: 2010-01-23 17:17:02.000000000 +1300
    Change: 2010-01-23 17:17:02.000000000 +1300

    root@lust [/]# stat /home
    File: `/home'
    Size: 4096 Blocks: 8 IO Block: 4096 directory
    Device: 801h/2049d Inode: 475137 Links: 14
    Access: (0711/drwx--x--x) Uid: ( 0/ root) Gid: ( 0/ root)
    Access: 2010-01-26 13:00:46.000000000 +1300
    Modify: 2010-01-26 09:08:52.000000000 +1300
    Change: 2010-01-26 12:32:37.000000000 +1300

    root@lust [/]# stat /home/usernamewashere/
    File: `/home/usernamewashere/'
    Size: 4096 Blocks: 8 IO Block: 4096 directory
    Device: 801h/2049d Inode: 552216 Links: 12
    Access: (0711/drwx--x--x) Uid: ( 508/usernamewashere) Gid: ( 504/usernamewashere)
    Access: 2010-01-26 18:49:23.000000000 +1300
    Modify: 2010-01-26 10:23:45.000000000 +1300
    Change: 2010-01-26 10:23:45.000000000 +1300

    root@lust [/]# stat /home/usernamewashere/public_html/
    File: `/home/usernamewashere/public_html/'
    Size: 4096 Blocks: 8 IO Block: 4096 directory
    Device: 801h/2049d Inode: 552232 Links: 5
    Access: (0750/drwxr-x---) Uid: ( 508/usernamewashere) Gid: ( 504/usernamewashere)
    Access: 2010-01-26 18:49:24.000000000 +1300
    Modify: 2010-01-26 09:10:07.000000000 +1300
    Change: 2010-01-26 09:10:07.000000000 +1300

    root@lust [/]# stat /home/usernamewashere/public_html/.htaccess
    File: `/home/usernamewashere/public_html/.htaccess'
    Size: 0 Blocks: 0 IO Block: 4096 regular empty file
    Device: 801h/2049d Inode: 552280 Links: 1
    Access: (0644/-rw-r--r--) Uid: ( 508/usernamewashere) Gid: ( 504/usernamewashere)
    Access: 2010-01-26 07:10:11.000000000 +1300
    Modify: 2010-01-23 01:58:53.000000000 +1300
    Change: 2010-01-26 08:55:03.000000000 +1300
     
  9. nzgeoff

    nzgeoff Member

    Joined:
    Jan 23, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    51
    I just installed SuPHP and during the installation it appears to have changed permissions slightly and everything is working perfectly now. Scripts are running as the correct user and the public_html folder remains as 750.

    Thanks for you help.
     
  10. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,544
    Likes Received:
    9
    Trophy Points:
    268
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Thank you for the update and information regarding resolution. For reference, was the change noticed that of the public_html directory having a different group ownership (e.g., a group or GID of "nobody")?
     
    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