A production-ready Bash wizard to migrate DirectAdmin accounts from a source server to a destination server using this workflow:
- Backup (multi-user) on the source server (DirectAdmin task queue)
- Transfer backups to destination (rsync, resumable)
- Restore (multi-backup) on the destination server (DirectAdmin task queue)
- Post-restore rsync of heavy data (
domains/+imap/) for speed and reliability - Ownership fixes on destination after syncing
Designed for real-world migrations to a newer server / infrastructure.
- Repo:
directadmin-migration-tool - Script:
da-backup-restore-migrate.sh
Run directly on the source server:
bash <(curl -kL --progress-bar https://raw.githubusercontent.com/090ebier/directadmin-migration-tool/refs/heads/main/da-backup-restore-migrate.sh)-
This downloads and executes the script in one step.
-
Run as root (recommended).
-
A detailed log is saved under:
/var/log/da_backup_restore_YYYYMMDD_HHMMSS.log
- Multi-user backup/restore using one DirectAdmin task per phase
- Resumable rsync (great for large mailboxes)
- Human-readable progress (KB/MB/GB) + detailed
--stats - Clean terminal UI (sections, colors, spinner, consistent prompts)
- Quiet SSH behavior (no
known_hostsspam / no “Permanently added …” messages) - SSH warm-up and connectivity validation before heavy steps
- Automatic destination backup directory creation + permission preparation for restore
-
bash,ssh,sshpass,rsync -
DirectAdmin installed and working:
/usr/local/directadmin/directadmin
-
DirectAdmin installed and working
-
SSH access (typically
root) to:- create/write backup path
- write to DirectAdmin
task.queue - run
directadmin taskq - fix permissions/ownership after restore
After DirectAdmin restore is triggered, the script does a heavy-data sync for each selected user:
/home/<user>/domains//home/<user>/imap/
Then it fixes ownership:
domains→<user>:<user>imap→<user>:mailif groupmailexists, otherwise<user>:<user>
The script uses rsync with a delete behavior (--delete-delay).
That means destination is treated as a mirror for the synced paths:
- If a file exists on destination but not on source, it may be removed on destination.
This is usually the desired behavior for clean migrations to a fresh server.
If you want merge-only behavior (never delete destination extras), remove --delete-delay from the rsync options in the script.
If users/domains already exist on destination, restore may fail due to conflicts (e.g., symlinks already exist). For smooth migrations, migrate into a clean environment or remove conflicts before restore.
When you run the script, it will ask for:
- Destination server IP/hostname
- SSH port
- SSH username
- Destination backup path
- Restore IP (auto if destination input is an IP)
- SSH password
- Account selection (single number, range, reseller, or select all)
The script prints the log path at startup and writes everything to:
/var/log/da_backup_restore_*.log
Check DirectAdmin logs on the destination server (common locations):
/usr/local/directadmin/data/admin/backup_restore.log/usr/local/directadmin/data/admin/backup.log
- The script uses
sshpass(password-based SSH) for automation. - SSH host key storage is disabled for clean output (no
known_hostswrites). - For long-term production usage, consider switching to SSH keys.