anyone good with ssh-agent & cronjobs?

Ben Duncan bns at meta3.net
Tue Jul 29 15:44:05 PDT 2014


We drive the court system updates using ssh, and we have a CnC server 
controlling about 80 servers.

What exactly are you trying to get done?

On 07/29/2014 01:14 PM, Lonni J Friedman wrote:
> 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
>
>


-- 
Ben Duncan - Business Network Solutions, Inc. 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor


More information about the Linux-users mailing list