This dude has a good tutorial but it didn't work lol
Do this on the remote server:
yum install rsync
mkdir -p /var/ServerBackup
ssh-keygen
send id_rsa.pub file to main server
scp /root/.ssh/id_rsa.pub [email protected]:/root/id_rsa.pub
Do this on the main server:
mkdir -p /root/.ssh
chmod 700 /root/.ssh
touch /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
cat /root/id_rsa.pub >> /root/.ssh/authorized_keys
add a cron:
crontab -e
0 2 * * * root bash backup.sh # the script file backup.sh is scheduled to be executed every day at 2:00AM.
make the cron bash file
cd /
vi backup.sh
#!/bin/sh
/usr/bin/rsync -avz -e "ssh -i /root/.ssh/id_rsa.pub" [email protected]:/etc /var/ServerBackup
Then you need to chmod the bashfile you just made(make it an exuacable file):
chmod +x backup.sh
/usr/bin/rsync -avz -e "ssh -i /root/id_rsa.pub" /var/www [email protected]:/Backup
Source:
Do this on the remote server:
yum install rsync
mkdir -p /var/ServerBackup
ssh-keygen
send id_rsa.pub file to main server
scp /root/.ssh/id_rsa.pub [email protected]:/root/id_rsa.pub
Do this on the main server:
mkdir -p /root/.ssh
chmod 700 /root/.ssh
touch /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
cat /root/id_rsa.pub >> /root/.ssh/authorized_keys
add a cron:
crontab -e
0 2 * * * root bash backup.sh # the script file backup.sh is scheduled to be executed every day at 2:00AM.
make the cron bash file
cd /
vi backup.sh
#!/bin/sh
/usr/bin/rsync -avz -e "ssh -i /root/.ssh/id_rsa.pub" [email protected]:/etc /var/ServerBackup
Then you need to chmod the bashfile you just made(make it an exuacable file):
chmod +x backup.sh
/usr/bin/rsync -avz -e "ssh -i /root/id_rsa.pub" /var/www [email protected]:/Backup
Source:

Last edited: