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.

cPanel update is chmod-ing my directories

Discussion in 'General Discussion' started by robocrop, May 20, 2008.

  1. robocrop

    robocrop Member

    Joined:
    Mar 19, 2008
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    A post account creation hook sets all my public_html directories to 0777 (I've considered security etc etc)

    The trouble is that when cPanel auto updates, it changes all of my public_html directories perms back to the default. Is there a way of stopping this?
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Disable the fileprotect feature. For 11.23:

    /scripts/disablefileprotect

    For older versions:

    rm /var/cpanel/fileprotect
     
  3. robocrop

    robocrop Member

    Joined:
    Mar 19, 2008
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    that answers the question :)

    maybe I can get your opinion on what I'm trying to achieve: My users never have access to cPanel. I use it only to host websites. Those are flat HTML websites generated by my main site and then copied to the /home/user/public_html dir by a browser-called PHP script and a CLI-called PHP script.

    The reason for the chmod 0777 on all public_html dirs is that the php can not copy the HTML to the public_html dirs without it.

    Is there another way to do this - allow one apache user to copy files to any public_html directory?

    Thanks.
     
  4. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    There are a variety of methods to handle this, depending upon the exact needs/requirements of the system. For example, must the process be handled by Apache?

    For example:

    1. Updated info/pages are stored in a central location
    2. At specified time, /home/user/public_html is updated by pulling from the central repository

    If each user has read access to the central store (from step 1), then it's simply a matter of copying the content from point A to point B.

    The trigger for step 2 could be a variety of things. For example, visiting a specific webpage on the account's domain. Or a cronjob that runs every minute (for the case of needing quick updates).

    The central store could be in a neutral location (e.g. /srv/data_store). The user account that performs updates/regeneration of the content would need full access to the neutral location. The other accounts would only need read access (0750 on the directories).


    The goal is to have the individual update processes run as the user in whose public_html directory the content is copied. The particulars will vary according to the exact needs and specifications of the system you are using.
     
  5. robocrop

    robocrop Member

    Joined:
    Mar 19, 2008
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    there are 2 process that happen when the user is logged in to the main central site.

    1. They click a button that copies their selected theme to their website, so img, css, js etc. A php script does this. e.g.
    /home/mainAcct/public_html/someDir to /home/user/public_html/someDir
    2. Their unique id is added to a table

    Every 10 minutes a cron job runs on the main site that grabs all of those IDs and then renders an HTML version of a user's profile page and does the same copy action as above but with the freshly generated HTML.

    Every HTML render is different for each user. I also think that as this is an irregular request from the user that it should be a push to the user's dir rather than a pull to it.

    It would be great if my one central cPanel account user (where the two PHP scripts run) had perms to copy to the user directories, but then I guess this is SuPHP. So I'm not sure I can use your method?
     
  6. robocrop

    robocrop Member

    Joined:
    Mar 19, 2008
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    is it as simple as commenting out this line?
    PHP:
    cPScript::SafetyBits::safe_chmod0755$useruid$homedir '/public_html' );
     
Loading...

Share This Page