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.

Can we create accounts using shell ?

Discussion in 'General Discussion' started by sh4ka, Apr 14, 2006.

  1. sh4ka

    sh4ka Well-Known Member

    Joined:
    May 12, 2005
    Messages:
    442
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    US
    cPanel Access Level:
    DataCenter Provider
    I'm wrinting a script that moves all accounts from an Ensim server, and restores everything in a cPanel server, everything is ok... but the only thing that is a pain in the ass.. is the fact that after the scripts moves all html, sql, etc, to the cPanel server, first i have to create account by account using WHM, the same with SQL databases... and after that i finally can run the script to restore all the data into each account..

    I wish there would be a way to create accounts from the server shell..?? does anybody know how to do that ??
    Also, is there a way to create a SQL database in cpanel using shell ?

    thkz!
     
    #1 sh4ka, Apr 14, 2006
    Last edited: Apr 14, 2006
  2. freedman

    freedman Well-Known Member

    Joined:
    Feb 13, 2005
    Messages:
    312
    Likes Received:
    1
    Trophy Points:
    18
    I believe you're looking for /scripts/adduser
    the arguments are:
    username homeroot password
    so:
    /scripts/adduser newuser1 /home2 password
    will create the user newuser1 with the homedirectory /home2/newuser1
    it will make the /home2 directory if it doesn't exist, so be careful.

    also, the password will get encrypted.. so if you're wanting to use the same password hash from the other system, you'll need to extract that and insert it back into the password file (be very careful)
    to add the user consult: /scripts/mysqladduserdb
    arguments are (user newpassword)
    that'll add the user db. then you should be able to use mysql with the appropriate user/pass arguments and pipe to it the output from mysqldump form the other server:
    /scripts/mysqladduserdb newuser1 password
    mysql -unewuser1 -ppassword < mysqlnewuser1dump.sql

    you'll have to do that for each users mysql user and database..

    if your usernames are the same, you might be better off dumping the entire mysql and restoring it on the new server...assuming all users from server A are going to Server B.. that may simplify your mysql issue??

    [EDIT] if it's not proprietary, it would be nice if you'd share your final script with the forums
     
    #2 freedman, Apr 14, 2006
    Last edited: Apr 14, 2006
  3. sh4ka

    sh4ka Well-Known Member

    Joined:
    May 12, 2005
    Messages:
    442
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    US
    cPanel Access Level:
    DataCenter Provider
    Thank you for your answer, it was a great help!, and of course i will share the script.. but not yet because it isn't finished.
    I was looking for a way to create DBs, not DB users, anyway thanks.
     
  4. eger

    eger Well-Known Member

    Joined:
    Feb 28, 2003
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    it sounds like you are looking for /scripts/wwwacct. this is the script used to create cPanel users with specific settings and can be run from the cmd line.
     
  5. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    Question ?

    Why not use the transfer account in the transfer section of WHM ?

    It will transfer a site from ensim to cpanel
     
  6. netkinetics

    netkinetics Well-Known Member

    Joined:
    May 14, 2004
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Home is Baltimore, MD - Currently in the Philippin
    You're looking for /scripts/wwwacct however as others have mentioned I highly recommend using the account copy feature found inside of WHM. I've tried it with all kinds of versions of Plesk and Ensim with great success.
     
  7. sh4ka

    sh4ka Well-Known Member

    Joined:
    May 12, 2005
    Messages:
    442
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    US
    cPanel Access Level:
    DataCenter Provider
    I didn't knew this exists!!! Does it work with Ensim 4.x ???
    Any other suggestions to transfer Ensim accounts to cPanel ??

    thkz!
     
Loading...

Share This Page