Is it possible to migrate account/accounts via command-line?
Yep, it’s possible and simple to migrate an account from command-line. In a cPanel server there are a lot of scripts are available to manage different operations simply through command-line. The scripts “pkgacct” and “restorepkg” are using to create a backup and restore the account from an already taken backup. From cPanel version 11.48 they have added Restricted Restore functionality to account restoration. The Restricted Restore feature performs additional security checks on the backup file in order to mitigate the risk of transfers from unfamiliar sources. If a component of the backup file has an issue (for instance, a MySQL grant table is compromised or a symbolic link attack), the system will not restore that portion of the backup and will add a warning to the log file.
1, Log into source server as root.
2, Making backup of the account.
Replace “username” with the actual username of the cPanel account.
3, Transfer the backup generated to destination server.
We can use different methods to tranfer the file from source to destination server. Some of them are SCP, RSYNC etc.
Read this >> Rsync command usages <<
4, Restoring account.
By using the script “restorepkg” we can simply restore an account from its cPanel backup.