HOSTNAME=`hostname`
AGENT_ENV_SH=$HOME/.agent_env-$HOSTNAME.sh
AGENT_IS_RUNNING=`ps x | grep ssh-agent | grep -v grep`
if [ -z "$AGENT_IS_RUNNING" ]; then
ssh-agent -s > $AGENT_ENV_SH
fi
if [ -f $AGENT_ENV_SH ]; then
# It is important to redirect output to /dev/null, otherwise, it will confuse scp
source $AGENT_ENV_SH >& /dev/null
fi
After the first login, type 'ssh-add', then never ask you the ssh phrase again.