Can we create accounts using shell ?

sh4ka

Well-Known Member
May 12, 2005
444
0
166
Uruguay
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!
 
Last edited:

freedman

Well-Known Member
Feb 13, 2005
314
5
168
sh4ka said:
I wish there would be a way to create accounts from the server shell..?? does anybody know how to do that ??
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)
sh4ka said:
Also, is there a way to create a SQL database in cpanel using shell ?
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
 
Last edited:

sh4ka

Well-Known Member
May 12, 2005
444
0
166
Uruguay
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.
 

eger

Well-Known Member
Feb 28, 2003
128
0
166
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.
 
sh4ka said:
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!
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.
 

sh4ka

Well-Known Member
May 12, 2005
444
0
166
Uruguay
cPanel Access Level
DataCenter Provider
dave9000 said:
Question ?

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

It will transfer a site from ensim to cpanel
I didn't knew this exists!!! Does it work with Ensim 4.x ???
Any other suggestions to transfer Ensim accounts to cPanel ??

thkz!