linux updates
alias df='df -h'
http://sial.org/howto/rsync/
rsync -avz -e ssh remoteuser@remotehost:/ /home/user/backup-starting-at-root-of-remote
rsync --deleted --progress --stats -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/ > backup-log.txt
-a = -rlptgoD which means recursive, symlinks as symlinks, permissions, time, group/owner, Devices (so the following isnt' necessary)
--exclude=/cdrom --exclude=/dev --exclude=/lost+found --exclude=/mnt --exclude=/opt --exclude=/proc --exclude=/sys --exclude=/tmp /
By default, rsync will only copy files and directories, but not remove them from the destination copy when they are removed from the source. To keep the copies exact, include the --delete flag: six@jammer:~/public_html# rsync -ave ssh --delete greendome:~one/reports .
rsync scripted securely
If that all worked out, or I eventually made it work, I am ready for the next step. I need to generate a private/public pair of keys to allow a 'ssh' connection without asking for a password. This may sound dangerous, and it is, but it is better than storing a user password (or key password) as clear text in the script [0]. I can also put limitations on where connections made with this key can come from, and on what they can do when connected. Anyway, I generate the key I will use on thishost (as thisuser): $ ssh-keygen -t dsa -b 2048 -f /home/thisuser/cron/thishost-rsync-key Generating public/private dsa key pair. Enter passphrase (empty for no passphrase): [press enter here] Enter same passphrase again: [press enter here] Your identification has been saved in /home/thisuser/cron/thishost-rsync-key. Your public key has been saved in /home/thisuser/cron/thishost-rsync-key.pub. The key fingerprint is: 2e:28:d9:ec:85:21:e7:ff:73:df:2e:07:78:f0:d0:a0 thisuser@thishost