How to Migrate All cPanel Accounts to DirectAdmin
With cPanel license costs rising, many hosting providers are migrating to DirectAdmin as a lightweight and cost-effective alternative. DirectAdmin provides migration tools that make it possible to transfer all cPanel accounts without losing websites, databases, or emails.
In this guide, we’ll walk through the exact steps to move all accounts from cPanel to DirectAdmin.
Prerequisites
Before you begin:
- Root SSH access to both the cPanel server and the DirectAdmin server.
- Enough free disk space to store temporary backups.
- rsync installed (usually preinstalled on Linux).
Step 1: Create Backups of All cPanel Accounts
On the cPanel server, create a directory for backups:
mkdir -p /home/all_backups
Now generate backups for every cPanel user account:
for user in `ls /var/cpanel/users/`; do { /scripts/pkgacct ${user} /home/all_backups; }; done
This will create a set of backup files in /home/all_backups/, one for each cPanel account.
Each backup will look like:
/home/all_backups/cpmove-USERNAME.tar.gz
Step 2: Transfer Backups to DirectAdmin Server
Next, transfer all backups to the DirectAdmin server. Replace your_directadmin_server.com with your server hostname or IP:
rsync -avt --delete /home/all_backups/ root@your_directadmin_server.com:/home/admin/all_backups/
Now you can disconnect from the cPanel server — we’re done with it.
Step 3: Fix File Ownership on DirectAdmin
On the DirectAdmin server, make sure all transferred backups belong to the admin user:
chown -R admin. /home/admin/all_backups
Step 4: Restore Accounts in DirectAdmin
Now restore all accounts through DirectAdmin’s admin panel:
- Log in as admin.
- Go to Admin Level → Admin Backup/Transfer → Restore.
- Set the path to:
/home/admin/all_backups - Select the accounts and click Restore.
DirectAdmin will now restore all websites, databases, emails, and DNS settings from the converted backups.
Step 5: Keep Backups for Safety
It’s a good idea to leave /home/admin/all_backups on the DirectAdmin server for a few weeks or months.
If something was missed during migration, you can easily extract it from the backup.
Alternative Method: Limited Disk Space on cPanel Server
If your cPanel server does not have enough space to generate all backups at once, you can migrate account by account and transfer directly to the DirectAdmin server.
First, set up passwordless SSH access between servers:
- On the cPanel server, generate an SSH key:
ssh-keygen(Press Enter to accept defaults). - Copy the contents of
/root/.ssh/id_rsa.pubto the DirectAdmin server’s file:/root/.ssh/authorized_keys(Create the/root/.ssh/directory if it does not exist).
Now you can loop through accounts one by one, transferring immediately after backup:
for user in `ls /var/cpanel/users/`; do {
/scripts/pkgacct ${user} /home/all_backups;
rsync -avt /home/all_backups/cpmove-${user}.tar.gz root@your_directadmin_server.com:/home/admin/all_backups/cpmove-${user}.tar.gz;
rm -f /home/all_backups/cpmove-${user}.tar.gz;
}; done
This method ensures only one backup exists at a time, saving disk space.
Verification
After migration, test:
- Websites load correctly.
- Databases are intact.
- Email accounts are working.
- DNS records are correct.
Conclusion
Migrating all accounts from cPanel to DirectAdmin is straightforward with the pkgacct tool and DirectAdmin’s built-in migration system.
- If you have enough space, back up all accounts, transfer them, and restore in bulk.
- If not, migrate accounts one by one using rsync with SSH keys.
This approach ensures a smooth transition from cPanel to DirectAdmin without downtime.
Leave a Reply