I have a remote machine, with which I have set up public-key ssh auth - that is, I can ssh to it without typing in password each time. And I have a set of actions in a script, which use that ssh connection.
But when I run that script via cron, it keeps asking passphrase for each action - and since I have more that ten of them, it gets quite boring.
I tried running ssh-add before those actions and got:
Could not open a connection to your authentication agent.
What can I do to reduce number of passphrase retypes?
crontab
of the user that owns the key? That is, you didn't do something silly like add the script call to the globalcrontab
, right? – Warren Young Feb 27 '12 at 17:59eval $(ssh-agent -s)
beforessh-add
(andssh-agent -k
at end). – enzotib Feb 27 '12 at 18:08