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!

Database accessible across accounts

Discussion in 'Database Discussion' started by jmartinmds, Nov 15, 2017.

  1. jmartinmds

    jmartinmds Member

    Joined:
    Jul 22, 2016
    Messages:
    9
    Likes Received:
    3
    Trophy Points:
    3
    Location:
    Maryland
    cPanel Access Level:
    DataCenter Provider
    I'm not sure if this is a feature or a bug. I set up two accounts on a server, www.example.com and site2.example.com. In www I put a standard WordPress installation, created a database and database user, put the correct information into wp-config.php and the site loads fine. I then copied the site files from /home/wwwsite/public_html to /home/site2/public_html, changed the permissions on the site, but did NOT create a database for site2. When I go to phpMyAdmin for site2 there's no database, as I would expect. However, if I go to site2.example.com what loads is www.example.com, which is what I would expect since both sets of files are working off the same database and the database has www.example.com as the site name. I did check to make sure the domain is resolving properly by uploading an image to site2, and site2.example.com/test.png does load properly with the correct URL displayed. If I alter the information in site2's copy of wp-config.php I do get the message Error establishing database connection, which again, is what I would expect.

    My question is this: is there a way to restrict a database from being accessed like this across cPanel accounts? When I look in WHM > Manage Databases it does show the owner of the database as wwwsite, so is there a way to lock it down so that site2's copy of wp-config.php cannot access the database?
     
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,657
    Likes Received:
    75
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    Don't give site2 the password to wwwsite's database?
     
  3. cPWilliamL

    cPWilliamL cP Technical Analyst II
    Staff Member

    Joined:
    May 15, 2017
    Messages:
    257
    Likes Received:
    29
    Trophy Points:
    103
    Location:
    America
    cPanel Access Level:
    Root Administrator
    MySQL limits database access via database user, password, and host. There isn't a limitation at the cPanel account level. If you connect with the same user, password, and host, you will have access.
     
    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