You are not logged in.

#1 2006-12-16 20:22:49

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

starting ssh-agent on login

ssh-agent is a blessing for convenient yet secure remote access, but the standard tool to start it up on login is in my opinion overly complicated. Keychain is a script in more than 1500 lines of code for doing essentially what I do in 8 lines. It does of course have tons more features, but I don't see any reason for all of that. Here's my /etc/profile.d/ssh-agent.sh, I hope somebody finds it useful:

# If the directory ~/.ssh/agent exists, ssh-agent is started automagically.
#
# The script first checks whether $HOSTNAME-sh already contains information
# about a running ssh-agent process, in which case nothing further is done.
#
# When necessary, which should only be once per reboot, ssh-agent is started
# and the two important variables are defined in $HOSTNAME-sh for use by
# future login sessions.
#
# Tip: Put '. /etc/profile' in your ~/.xinitrc and ~/.xsession
#      This is a good idea not only because of this script.

if [ -d $HOME/.ssh/agent ]; then
  [ -f $HOME/.ssh/agent/$HOSTNAME-sh ] && . $HOME/.ssh/agent/$HOSTNAME-sh
  if ! [ -S "$SSH_AUTH_SOCK" ]; then
    eval `/usr/bin/ssh-agent` > /dev/null
    echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >  $HOME/.ssh/agent/$HOSTNAME-sh
    echo "export SSH_AGENT_PID=$SSH_AGENT_PID" >> $HOME/.ssh/agent/$HOSTNAME-sh
  fi
fi

All of your mips are belong to us!!

Offline

Board footer

Powered by FluxBB