anyone good with ssh-agent & cronjobs?

Lonni J Friedman netllama at gmail.com
Tue Jul 29 11:14:22 PDT 2014


I'm trying to sort out the right way to use ssh-agent (using ssh keys)
from inside of shell script driven cronjobs.  ssh-agent works fine
outside of the crobjob (and even if I run the shell script manually).
However, when invoked via cron, the script fails to connect to the
pre-existing ssh-agent, and ssh auth fails as a result.  I've googled
quite a bit, and the advice is rather muddy.  There are dozens of
super hacky 'solutions', which seem to work for some people and not
others.  The crux of the problem seems to be figuring out a reliable
way of acquiring the SSH_AUTH_SOCK & SSH_AGENT_PID variables for the
pre-existing ssh-agent session that already has all my ssh keys loaded
into it.  I'd like to think its as easy as running 'ssh-agent -s',
however all that seems to do is spawn a new agent session which has no
keys pre-loaded, and is effectively useless.

What am I missing here?  Surely this has to work, right?

thanks


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman                                    netllama at gmail.com
LlamaLand                       http://netllama.linux-sxs.org


More information about the Linux-users mailing list