Database accessible across accounts
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?
-
Don't give site2 the password to wwwsite's database? 0 -
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. 0
Please sign in to leave a comment.
Comments
2 comments