1. source, destination server에 인증key를 등록한다.
이걸 안하면 password를 넣으라는 문구가 뜬다.
$ ssh-keygen -d
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):[press enter here]
Enter passphrase (empty for no passphrase): [press enter here]
Enter same passphrase again: [press enter here]
Your identification has been saved in /home/thisuser/.ssh/id_dsa.
Your public key has been saved in /home/thisuser/.ssh/id_dsa.pub.
The key fingerprint is:
2e:28:d9:ec:85:21:e7:ff:73:df:2e:07:78:f0:d0:a0 thisuser@thishost
$ scp /home/thisuser/.ssh//id_dsa.pub remoteuser@remotehost:/home/thisuser/.ssh/authorized_keys
2. rsync로 싱크를 한다.
$rsync -e ’ssh -ax’ -avz –delete –delete-excluded /home/thisuser/automatic-backup/ remoteuser@remotehost:/home/remoteuser/automatic-backup
3. crontab 에 등록하게 되면 일정한 시간에 자동으로 백업을 진행한다.