< Day Day Up > |
17.8.1 ProblemYou want to schedule some backups or file transfers via SSH, using cron. How do you tell cron to look to keychain to handle authentication of remote hosts? 17.8.2 SolutionUse the same source line in your cron scripts that you used in your .bash_profile. This is a simple script that uses rsync to back up a user's home directory: #!/bin/bash source /home/saz/.keychain/$HOSTNAME-sh rsync -a -e ssh --delete --force rsync.test.net::home/saz/ /backups/saz Slap it in a cron job, and you're fully automated until the next reboot. 17.8.3 DiscussionAgain, using null-passphrase keys leaves your private keys wide open to being misused by anyone who gains access to them. Using keychain ensures that you can properly protect your SSH keys with passphrases and still automate SSH transfers. 17.8.4 See Also
|
< Day Day Up > |