This guide shows how to securely transfer data between a production server and a Remote Backup Server using rsync
over SSH. It includes examples for both password-based and SSH key-based authentication, as well as JetBackup snapshot transfers.
๐ Prerequisites for SSH Key Authentication
- Generate an SSH Key (if not already done):
ssh-keygen -t rsa -b 4096
- Upload the public key (
~/.ssh/id_rsa.pub
) to your Remote Backup Server. - Ensure your private key (
~/.ssh/id_rsa
) is accessible to the user initiating the rsync.
๐ Backup: Production โ Remote Backup Server (with SSH Key)
rsync -av --progress -e "ssh -i ~/.ssh/id_rsa -p 36256" /home/example [email protected]:/buffer/example
๐ Restore: Remote Backup Server โ Production (with SSH Key)
rsync -av --progress -e "ssh -i ~/.ssh/id_rsa -p 36256" [email protected]:/buffer/example /home/example
๐ฆ Backup JetBackup Snapshots (From within cPanel account, with SSH Key)
rsync -avR --progress -e "ssh -i ~/.ssh/id_rsa -p 45311" ./jetbackup_1_1_5c732966bdf5a655e55542e2/*/snap.2019-03-18* [email protected]:/buffer
๐ฅ Restore JetBackup Snapshots from Remote Backup Server (with SSH Key)
rsync -av --progress -e "ssh -i ~/.ssh/id_rsa -p 36256" [email protected]:/buffer/example /home/example
๐ Notes
- Replace
~/.ssh/id_rsa
with the path to your actual private key file if it’s different. - Ensure correct file/directory permissions on the SSH key (typically
chmod 600
). - Avoid using root access unless necessaryโnon-root users can be configured appropriately.
- The
--progress
flag helps monitor transfers, especially over slower links.