I needed to backup my wife’s MacBook to our home server and have it be “1 click” easy so she’d use it. I used ssh and rsync so she could use it anywhere securely.
First I generated her ssh key:
First I generated her ssh key:
ssh-keygen -t dsa -b 1024 -f ~/.ssh/backup-key
Then I copied the contents of .ssh/backup-key.pub to her ~/.ssh/authorized_keys2 file on the server.
And finally, I created the following script to backup to the server:
#!/bin/sh # This backs up Eve's data # Backup with this one: rsync -avz -e "ssh -i /Users/eve/.ssh/backup-key" --delete --stats --progress /Users/eve eve@myserver.com:/home/eve/ --exclude '.Trash' --exclude '.DS_Store'
And that does the trick. Backs up, deletes files that have been deleted on the Mac, and excludes .Trash and .DS_Store files.