How to rsync from server to server

mar

bitcoin is freedom
Staff member
Joined
Jan 14, 2015
Messages
170
Points
28
Credits
55,526,874
Bronze Usergroup
Username Style
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 root@A.com:/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" root@A.com:/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 root@Domain.com:/Backup






Source:


 
Last edited:
The Biggest Forums - The Biggest, Largest, Best, Most Popular Forums and Message Boards Top List on the Internet.
The Biggest Forums - The Biggest, Largest, Best, Most Popular Forums and Message Boards Top List on the Internet. Forum-List.com

Number of visitors since November 2018: