Results 1 to 4 of 4

Thread: WHM Domain User Cross Folder Permission

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    2

    Question WHM Domain User Cross Folder Permission

    Hello All,

    I have a Dedicated Server with some 50 domains hosted on it as individual Accounts. I am trying to give write permission to the user of the first domain to a folder on the second users web directory. Here is the layout:

    Domain1.com
    -------------
    Admin User: domain1
    Web Path: /home/domain1/public_html/

    Domain2.com
    -------------
    Admin User: domain2
    Web Path: /home/domain2/public_html/
    Upload Path: /home/domain2/public_html/uploads/

    I have set the permission for the "uploads" folder which is on domain2.com to 777, but it still gives me this error when a PHP script from domain1.com tries to upload an image file to domain2.com:

    Code:
    Warning: move_uploaded_file(/home/domain2/public_html/uploads/201207221737071.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/domain1/public_html/content.php on line 103
    I have already tried giving "domain1" user ownership of the "uploads" folder on domain2.com using the following command which made no difference:

    Code:
    chown -Rv domain1 /home/domain2/public_html/uploads/
    Any help would be much appreciated.

    Thanks,
    Pete

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: WHM Domain User Cross Folder Permission

    Hello Pete,

    If you are using suPHP, then FileProtect prevents this behavior and it's why you cannot get this to work.

    The options are to:

    a) disable FileProtect using "/scripts/disablefileprotect" whcih poses a grave security risk
    b) Place the contents into /usr/local/cpanel/htdocs/ instead to call them and link from each account to those files or that folder (discussed at http://forums.cpanel.net/f5/read-php...ml#post1010212)
    c) Use the suggestion in this post at http://forums.cpanel.net/f5/sync-dir...ml#post1188331 for creating a hard link and using bindfs

    Thanks!
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    2

    Default Re: WHM Domain User Cross Folder Permission

    Hello Tristan,

    Thank you for your response.

    Regarding a) I agree that this would be a huge risk, so I would rather not go this route.

    Regarding b) I don't think this is a good option for me to use because I need a whole different "uploads" folder for each domain since there will be domain3, domain4, etc and each will need it's own "uploads" folder, but I still want the "domain1" user which is where the Admin Area for all domains resides to be able to write to these folders. I am also a bit worried that the media files would be residing in a system folder (/img-sys/media.ext). Is this risky?

    Regarding c) After reading the post in the link you gave me above I got the impression that bindfs is basically a directory pointer/link in the file system.

    Perhaps it would make sense for me to create individual sub-folders inside "/img-sys/" as "/img-sys/domain1/uploads/", and so forth and then place a link folder to each upload folder so that the path is still "domain1.com/uploads" on the web server but it resides inside the "/img-sys" folder where all users have access to it?

    Thanks,
    Pete

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: WHM Domain User Cross Folder Permission

    Hi Pete,

    The folder would need to be /usr/local/cpanel/htdocs for anything that isn't an image such as a script. I didn't extensively test using that shared folder either, but only tested basic scripts. You are definitely welcome to try it. If it doesn't work, the option would be to fall back to using option c)

    Thanks!
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. Replies: 6
    Last Post: 09-25-2011, 06:07 PM
  2. Replies: 6
    Last Post: 07-13-2009, 12:27 PM
  3. Default Folder Permission
    By Fjeddy in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 09-18-2008, 01:23 PM
  4. Folder permission
    By socheat in forum New User Questions
    Replies: 3
    Last Post: 03-19-2007, 10:43 PM
  5. cPanel User Parameter Cross-Site Scripting Vulnerability [old]
    By maaking in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 07-16-2005, 10:06 AM