Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Aug 2009
    Posts
    7

    Default User databases are no longer created

    I've somehow changed my default behavior for WHM. Prior to this, for each new account I created from WHM, I would get a MySQL User and a MySQL database. Now I only get the User.

    I can find threads that indicate ppl used to modify some of the post*acct scripts to create the databases, however I've never touched these and I think the database creation has become part of the WHM core now. But I can't find where the settings controlling it would be.

    I also know that others have databases created automatically because an error message I remember has been mentioned several times on this forum:\
    "Account Creation Status: failed (Sorry, a MySQL database with the name * already exists.)" I once got that error when I had already created a database under the name of an account I was adding.

    You can see that message referenced in these two threads:
    http://forums.cpanel.net/f5/add-user...tml#post502701
    http://forums.cpanel.net/f5/very-biz...or-122569.html

    My VPS provider is trying to convince me that I never had that functionality and I just want to get it back.

    Can someone here be of assistance?

    I lost the behavior around the time I added packages to my account. However I don't want to drop all of the packages I've made and assigned to various accounts if I don't have to.

    Does anyone know how to activate the automatic creation of databases for each new account created by WHM/CPanel?

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    On a plain installation of cPanel/WHM, no databases are created when a cPanel user is created. The only thing that happens is that the cPanel user is granted access to any databases they may create. However, using your cPanel user credentials for databases is generally not a good idea as this often involves storing your cPanel password in plain text.

  3. #3
    Member
    Join Date
    Aug 2009
    Posts
    7

    Default

    Hmm interesting...

    In my research I was able to find the source of the "Account Creation Status: failed (Sorry, a MySQL database with the name * already exists.)" error message.

    That comes directly from /usr/local/cpanel/bin/wwwacct
    That's part of default cpanel right? (Please don't read any snarkiness in that, it's a real question as I see it wwwacct mentioned as a script too)

    It seems likely that there's a switch that triggers that section of code in wwwacct, but I can't find mention of it as a parameter in documentation and since that's a binary, viewing it is less than helpful. I was hoping wwwacct.conf might have a setting for it but no go...

    What you've mentioned about the security concerns does make sense. However, since my server is already using that wwwacct feature, my password information is probably already stored in plain text. some my.cnf somewhere seems a likely spot for that.

    Do you have any thoughts about where I should go from here in this investigation? As the mention of that error message in other threads indicates, I'm not the only person whose had their CPanel behaving this way. I'd just like to return to my previous behavior...
    Last edited by BrianLayman; 08-03-2009 at 04:54 PM.

  4. #4
    cPanel Staff
    Join Date
    Jul 2009
    Posts
    1

    Default

    Quote Originally Posted by BrianLayman View Post
    Hmm interesting...

    In my research I was able to find the source of the "Account Creation Status: failed (Sorry, a MySQL database with the name * already exists.)" error message.

    That comes directly from /usr/local/cpanel/bin/wwwacct
    That's part of default cpanel right?

    It seems likely that there's a switch that triggers that section of code, but I can't find mention of it in documentation and since that's a binary, viewing it is less than helpful.

    What you've mentioned about the security concerns does make sense. However, since my server is already using that wwwacct feature, my password information is probably already stored in plain text.

    Do you have any thoughts about where I should go from here in this investigation? As the mention of that error message in other threads indicates, I'm not the only person whose had their cpanel behaving this way. I'd just like to return to my previous behaviour...
    /scripts/wwwacct is the command-line script used to create cPanel accounts. When a cPanel account is created on the server, it is created as a standard Unix user. This means that the password is stored as a hash, not in plain text. This also means the password cannot be retrieved. The system can compare if the user entered the correct password, but it does not know what the actual password is.

    Your previous behavior may have (and I'm just speculating) been triggered by a /scripts/postwwwacct script. The /scripts/postwwwacct script is a way to perform additional actions after an account is created such as calling our XML API to create a database for that user which was just created by /scripts/wwwacct.

  5. #5
    Member
    Join Date
    Aug 2009
    Posts
    7

    Default

    Quote Originally Posted by cPanelDaveG View Post
    /scripts/wwwacct is the command-line script used to create cPanel accounts. When a cPanel account is created on the server, it is created as a standard Unix user. This means that the password is stored as a hash, not in plain text. This also means the password cannot be retrieved. The system can compare if the user entered the correct password, but it does not know what the actual password is.

    Your previous behavior may have (and I'm just speculating) been triggered by a /scripts/postwwwacct script. The /scripts/postwwwacct script is a way to perform additional actions after an account is created such as calling our XML API to create a database for that user which was just created by /scripts/wwwacct.
    reostwwwacct Yeah that's where I started looking this morning, but I've no indiciation that such a file ever existed.

    Thinking on this further however, there seems to be a flaw in the above logic. The info about how the user acct pw is stored while accurate, seems likely to be irrelevant. No user password is needed to create a database for the user. Anyway, this was a process done within /usr/local/cpanel/bin/wwwacct not the script version. That's where the error handling is. See, this is copied from a hex view of that file: "Sorry, a mysql database with the name [NULL] already exists."


    Obviously CPanel already has root access to MySql as it has created the new user in MySQL with the correct password. At that point only two more queries need be made:
    CREATE DATABASE `newusersname` ;
    GRANT ALL PRIVILEGES ON `newusersname` . * TO 'newusersname'@'%';
    and we have the new database. Neither of those require a password so there is no security risk.

    I've downloaded my VPS's cpanel files to my local system and will test further. Maybe I'll find something over in /var/cpanel. All the pm files are at least fun to look at and I'm learning a lot more about how cpanel was built. I even found a bug in the error message "Sorry you cannot create this account because this would excceed your alloted bandwidth." Exceeded was typed with an accent.

    I'd still love to hear more thoughts if anyone has them..

  6. #6
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,788
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    The automatic creation of MySQL databases by cPanel during account creation was a bug. We fixed it. If you desire that behavior you need to use a /scripts/postwwwacct script ( or one of the various other hook scripts ).
    Kenneth
    Product Manager
    cPanel, Inc.

  7. #7
    Member
    Join Date
    Aug 2009
    Posts
    7

    Default

    Quote Originally Posted by cpanelkenneth View Post
    The automatic creation of MySQL databases by cPanel during account creation was a bug. We fixed it. If you desire that behavior you need to use a /scripts/postwwwacct script ( or one of the various other hook scripts ).
    Aha! Well that explains all...

    Thank you very much, cpanelkenneth.

    On the positive side, I've learned enough about how cpanel works through my searches that whipping up the script should be a breeze.

    Cheers!

Similar Threads & Tags
Similar threads

  1. Option to skip databases when backups are created
    By cPanelJeff in forum Feature Requests for cPanel/WHM
    Replies: 2
    Last Post: 08-15-2011, 08:10 AM
  2. [case 45836] CPANEL API not adding created user to created database
    By tdmohr in forum Archived Feature Requests
    Replies: 23
    Last Post: 03-19-2011, 07:07 AM
  3. sql databases created by magic
    By outlaw web in forum Database Discussions
    Replies: 7
    Last Post: 04-09-2008, 12:01 PM
  4. sql databases created by magic
    By outlaw web in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 04-09-2008, 12:01 PM
  5. created ftp user, user cant log in.
    By shaun in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 02-03-2004, 12:07 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube