SSH and agent article (was: scp in batch mode)
Christian Vogel
chris at obelix.hedonism.cx
Sat Feb 12 06:33:59 EST 2005
Hi,
here is what I used to use for a long time to have only one
ssh-agent running on my machine(s), so I don't use the spawn-subcommand form :-)
> #!/bin/sh
>
> ###
> # warning: This script should be sourced from your
> # login-files!
> ###
>
> AGENT_SCRIPT=~/.ssh/AGENT-"$HOSTNAME"
>
> function start_ssh_agent(){
> ( cd / ; ssh-agent -s ) | grep -v "^echo" >$AGENT_SCRIPT
> chmod 600 $AGENT_SCRIPT
> . $AGENT_SCRIPT
> ssh-add ~/.ssh/id_dsa
> ssh-add ~/.ssh/identity
> }
>
> if [ -f $AGENT_SCRIPT ] ; then
> . $AGENT_SCRIPT
> if ! kill -0 $SSH_AGENT_PID 2>/dev/null ; then
> echo "*** SSH-AGENT DIED. STARTING NEW SSH-AGENT ***"
> start_ssh_agent
> fi
> else
> echo "*** STARTING NEW SSH-AGENT ***"
> start_ssh_agent
> fi
>
>
> unset start_ssh_agent
--
There is a chasm
of carbon and silicon
the software can't bridge
-- Rahul Sonnad
More information about the openssh-unix-dev
mailing list