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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Change Account Doc Root Question

Discussion in 'Security' started by cosmoscookie, Feb 27, 2017.

  1. cosmoscookie

    cosmoscookie Member

    Joined:
    Feb 27, 2017
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Turkey
    cPanel Access Level:
    Root Administrator
    I am wondering if there is a way to point a cPanel account's primary SSL domain documentroot to a folder that owned by another account
     
  2. Jcats

    Jcats Well-Known Member

    Joined:
    May 25, 2011
    Messages:
    599
    Likes Received:
    92
    Trophy Points:
    153
    Location:
    New Jersey
    cPanel Access Level:
    DataCenter Provider
    You can yes, but there would be issues since the accounts ownership would be different.

    You would modify this file:

    /var/cpanel/userdata/$cpuser/domain.com_SSL

    then modify the line:

    documentroot: /home/$cpuser2/public_html

    Again, you will run into issues since the other accounts files will be owned by a different user.

    Once you update that file, make sure to run:

    Code:
    # /scripts/rebuildhttpdconf
    # /scripts/restartsrv_httpd
     
  3. cosmoscookie

    cosmoscookie Member

    Joined:
    Feb 27, 2017
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Turkey
    cPanel Access Level:
    Root Administrator
    Thank you for the answer. I already tried to change those lines in domain.com and domain.com_SSL files and got 500 internal server error. So, what should I do to get rid of that server error?

    Regards
     
  4. cosmoscookie

    cosmoscookie Member

    Joined:
    Feb 27, 2017
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Turkey
    cPanel Access Level:
    Root Administrator

    Hello. Thank you for the answer. I already tried to change those lines in domain.com and domain.com_SSL files and got 500 internal server error. So, what should I do to get rid of that server error? Do you have any idea?

    Regards
     
  5. Jcats

    Jcats Well-Known Member

    Joined:
    May 25, 2011
    Messages:
    599
    Likes Received:
    92
    Trophy Points:
    153
    Location:
    New Jersey
    cPanel Access Level:
    DataCenter Provider
    Yeah again, its most likely because you are trying to access files that belong to a different user.

    PHP runs as the cPanel user, so basically, user1 is trying to access files owned by user2.

    Try:

    Code:
    # tail -f /usr/local/apache/logs/error_log
    then while you are tailing that log, hit refresh a few times in your browser, then copy / paste the results here.
     
  6. cosmoscookie

    cosmoscookie Member

    Joined:
    Feb 27, 2017
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Turkey
    cPanel Access Level:
    Root Administrator
    Here is the result;

    [client MYIPADRESS:64317] SoftException in Application.cpp:447: Mismatch between target UID (522) and UID (528) of file "/home/vipplaket/public_html/v2/index.php"
    [Mon Feb 27 20:02:23.347755 2017] [core:error] [pid 28666:tid 139834783893248]

    By the way there is an index.html file and some pictures connected to it on /public_html/ folder. The domain works and opens that index.html file and its attachments when I try to point it to the folder /public_html/

    500 error occurs when I point it /public_html/v2 folder. Permissions of /v2 folder is 755. I also tried to change its permissions 750, error changed but didn't work again. Here is the result of permission 750;

    [Mon Feb 27 20:15:51.778088 2017] [core:crit] [pid 18232:tid 139834930751232] (13)Permission denied: [client MYIPADDRESS:64849] AH00529: /home/vipplaket/public_html/v2/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/vipplaket/public_html/v2/' is executable, referer: domain.com/
    The original website also doesn't work when I change permissions to 750

    Regards
     
    #6 cosmoscookie, Feb 27, 2017
    Last edited by a moderator: Feb 27, 2017
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  8. cosmoscookie

    cosmoscookie Member

    Joined:
    Feb 27, 2017
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Turkey
    cPanel Access Level:
    Root Administrator
    Thank you @cPanelMichael , I checked the link you gave. But I'm not sure symlink is what I want to do.

    I use a VPS and all accounts on that VPS are mine. I want to create a multistore system and I need to point several domain names (with dedicated IPs and SSL certified) to one core folder on my VPS.

    I've been trying something so far. I've edited some files of accounts under /var/cpanel/userdata/ folder and successfully pointed an account primary domain to another account's root folder. I can access all html and image files via this way, but php scripts won't run and turns 500 internal server error. I think it's because permissions.

    Can you please tell me if there is a way to make this system web work.

    Regards
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    The referenced thread discusses the use of a symbolic link, but the same restrictions would apply when attempting to share a directory owned by another user.

    You'd need to setup a single cPanel account and add each domain name as Addon domains to the account if you need to share a directory. Otherwise, you're going to encounter file ownership issues. Another option is to setup a cron job that copies the same set of files to each account so that each individual account owns the files they are attempting to access.

    Thank you.
     
Loading...

Share This Page