Automated Backup of Remote Linux Server to Local USB Disk using Rsync and Cygwin
1, Install Cygwin
download Cygwin http://www.cygwin.com/ and install on your PC
2, Generating public/private dsa key pair, do not enter password ( when asked for to enter passphrase, just press [ENTER] key twice.)
$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/Alan/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/Alan/.ssh/id_dsa.
Your public key has been saved in /home/Alan/.ssh/id_dsa.pub.
The key fingerprint is:
5a:56:7e:7d:4b:00:a0:56:09:34:f0:8f:dd:71:32:9c Alan@MyLaptop
3, Copy public key to remote server:
scp ~/.ssh/id_dsa.pub root@xxx.com:.ssh/authorized_keys
4, Make sure you keep your laptop in safe place because now anybody can login to your remote server from your labtop without a password.
5, Create a backup directory on USB disk and creacte a backup script
$ mkdir /cygdrive/f/backup
$ mkdir /cygdrive/f/backup/disk2
$ mkdir /cygdrive/f/backup/home
$ mkdir /cygdrive/f/backup/root
$vi backup.sh
#!/bin/sh
rsync --exclude '*.log' -avz -e ssh root@xxx.com:/home/ /cygdrive/f/backup/home
rsync $ -avz -e ssh root@xxx.com:/disk2 /cygdrive/f/backup/disk2
rsync $ -avz -e ssh root@xxx.com:/root /cygdrive/f/backup/root
$chmod 755 ./backup.sh
6, Create a cron job
crontab -e
0 0 * * * //backup.sh >/dev/null &
#* min (0 - 59) * hour (0 - 23) * day of month (1 - 31) *month (1 - 12) day of week (0 - 6) (Sunday=0)
Popularity: 1%



















































Methods and Software for Protecting Against SSH Brute-Force Attacks on Linux Server (Redhat, CentOS) | my-whiteboard said,
July 18, 2008 @ 5:00 pm
[...] see My-Whiteboard.com for example : http://www.my-whiteboard.com/linux-admin/automated-backup-of-remote-linux-server-to-local-usb-disk-u... [...]