Laden...

Anlage 9 - Using RSync and SSH


1.  Keys, Validatin and Automation
I like to backup some logging, mail, and configuration information sometimes on hosts across the network and Internet, and here is a way I have found to do it. You'll need these packages installed: rsync openssh cron (or vixie-cron) Please note these instructions may be specific to Red Hat Linux versions 7.3,... mehr

2.  Configuring this host
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... mehr

3.  Troubleshooting
Now that I have the key with no password in place and configured, I need to test it out before putting it in a cron job (which has it's own small set of baggage). I exit from the ssh session to remotehost and try: $ rsync -avz -e "ssh -i /home/thisuser/cron/thishost-rsync-key" remoteuser@remotehost:/remote/dir... mehr

4.  Cron Job Setup
The last step is the cron script. I use something like this: #!/bin/sh RSYNC=/usr/bin/rsync SSH=/usr/bin/ssh KEY=/home/thisuser/cron/thishost-rsync-key RUSER=remoteuser RHOST=remotehost RPATH=/remote/dir LPATH=/this/dir/ $RSYNC -az -e "$SSH -i $KEY" $RUSER@$RHOST:$RPATH $LPATH because it is easy to modify the... mehr