Situation: Running Ubuntu 10.04. I have a bash script that tar's a bunch of folders and copies them to another host over ssh. I've copied the public key to the other host so it doesn't prompt for a password.
I run eval ssh-agent
(with extra quotes) and ssh-add
to cache to passphrase and after that I can run the script without it prompting for anytime. So far so good.
Problem: I want to run this script through a cronjob, under my own user for now (this is just a test-setup). But when I restart the machine, ssh-agent loses the keys I added via ssh-add and I have to do eval ssh-agent & ssh-add again to get it working.
Question: - How do I make ssh-agent run at all times? (since there won't be a user logged in when the cronjob runs) - How do I permanently save my rsa_id to ssh-add?