This guide explains how to upload (push) and download (pull) data between your cPanel server and OVH Cloud Archive using rsync
over SSH, secured with SSH keys, and optionally automated with cron jobs.
π Prerequisites
- A cPanel server with SSH access (via root or sudo user).
- OVH Cloud Archive account.
- Your OVH Cloud Archive SSH gateway (e.g.,
gateways.storage.gra.cloud.ovh.net
). - SSH key access configured (steps below).
rsync
installed (preinstalled on most Linux servers).
π§ Step 1: Set Up SSH Key Authentication
1. Generate SSH key pair (on the cPanel server):
ssh-keygen -t rsa -b 4096 -C "[email protected]"
- Press Enter to accept the default save location (
/root/.ssh/id_rsa
). - Press Enter twice to leave the passphrase empty (for automation).
2. Add the public key to OVH:
cat ~/.ssh/id_rsa.pub
- Copy the output and add it to your OVH Cloud Archive SSH key section via the OVH Control Panel.
3. Test SSH connection:
ssh [email protected]
- You should log in without being prompted for a password.
β¬οΈ Push from cPanel to OVH Cloud Archive
This uploads data from your cPanel server to OVH Cloud Archive.
Manual push command:
rsync -rtv --progress /path/to/local-folder [email protected]:/my-archive-folder
/path/to/local-folder
: local directory on your server/my-archive-folder
: remote path on OVH Cloud Archive
β¬οΈ Pull from OVH Cloud Archive to cPanel
This downloads data from OVH Cloud Archive to your cPanel server.
Manual pull command:
rsync -rtv --progress [email protected]:/my-archive-folder /path/to/local-folder
- This fetches your archived data into your local backup directory.
π Automate with Cron Jobs
π Create Push Script
Save as: /root/scripts/ovh_push.sh
#!/bin/bash
LOCAL_DIR="/path/to/local-folder"
REMOTE_USER="exampleuser"
REMOTE_HOST="gateways.storage.gra.cloud.ovh.net"
REMOTE_PATH="/my-archive-folder"
rsync -rtv --delete "$LOCAL_DIR" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH"
Make it executable:
chmod +x /root/scripts/ovh_push.sh
π Create Pull Script
Save as: /root/scripts/ovh_pull.sh
#!/bin/bash
LOCAL_DIR="/path/to/local-folder"
REMOTE_USER="exampleuser"
REMOTE_HOST="gateways.storage.gra.cloud.ovh.net"
REMOTE_PATH="/my-archive-folder"
rsync -rtv --delete "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH" "$LOCAL_DIR"
Make it executable:
chmod +x /root/scripts/ovh_pull.sh
π Schedule Cron Jobs
Edit root’s crontab:
crontab -e
π Daily Push at 3 AM:
0 3 * * * /root/scripts/ovh_push.sh >> /var/log/ovh_push.log 2>&1
π Daily Pull at 4 AM:
0 4 * * * /root/scripts/ovh_pull.sh >> /var/log/ovh_pull.log 2>&1
π Security Tips
- Protect your SSH keys:
chmod 600 ~/.ssh/id_rsa
chmod 700 ~/.ssh
- Limit SSH access in OVH to the required archive operations.
- Rotate your keys and audit cron logs regularly.
β Summary
Operation | Direction | Secure via SSH Keys | Automated via Cron |
---|---|---|---|
Push | cPanel β OVH | β | β |
Pull | OVH β cPanel | β | β |