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!

Restore an account with Database Mapping

Discussion in 'General Discussion' started by Rane, Apr 6, 2011.

  1. Rane

    Rane Registered

    Apr 6, 2011
    Likes Received:
    Trophy Points:
    Within the white paper for Database Mapping it states:

    "User account backups generated with cPanel 11.28 may contain database resources that depend on DB Mapping and should only be restored on cPanel 11.28 and later."

    However, is it safe to Backup a user account on an 11.28 server with Prefixing “Off” and Restore it to an 11.28 server with Prefixing “On” ?

    Thank you
  2. cPanelDavidN

    cPanelDavidN Integration Developer

    Dec 17, 2009
    Likes Received:
    Trophy Points:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi Rane,

    Technically, the restore process, under the scenario you mention, should work. However, it's not advised. Mainly due to the following scenario:

    1) Server A 11.28 = Prefixing "Off"
    user: johnj (user to backup)

    2) Server B 11.28 = Prefixing "On"

    On Server A, user "johnj" is allowed to create databases with any arbitrary name, which includes databases with a prefix literally in the name, like johnj_* or jj_* or whatever_*. As long as a database of the same, literal name, doesn't exist, he can create it.

    So, if we backup that account and move it to Server B and restore, cPanel *should* honor the databases in the backup file for johnj...unpackaging and giving direct grants to his account for those databases. (I say *should*...I haven't looked at the restore code lately, but I'm fairly certain we don't do any magic filtering that would prevent a successful restore like this)

    So...all is well and good for "johnj". But, if on Server B there's a user named "jj", the "jj" user will automatically have access to johnj's restored database "jj_db2". The reason why this happens is that on a system with prefixing "On" each cPanel user has a MySQL database wildcard grant based on their prefix. i.e. user "jj" has a db grant to "jj\_%". This has been the case for cPanel accounts/MySQL permissions for a long while now.

    cPanel systems 11.28+ now always create explicit grants for databases. The existence of the wildcard grant is a legacy item and may disappear in the future. When you switch a system from prefixing "On" to "Off", the wildcard grant is removed for all cpanel accounts. And thus, it's not a security concern and, because of my prior statement in this paragraph, the user's still have access to all their db resources.

    It's because older cPanel systems (<11.28) do not make these explicit grants per database (but rely on the wildcard grant) that it's not feasible to migrate an account that has non-prefixed database. (at least, that's one reason).

    Hope this answers your question. Let us know if there's anything else.

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

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