[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RFC] Initialisation of ssh-agent



Hi,

Currently I am writing a piece on the why and how of setting up SSH2 for
public key authentication. For now it is in Dutch, but an English
version will follow later on. In this document I want to show a couple
of examples of starting ssh-agent from ~/.xsession, ~/.profile or
~/.login.

This is what I have so far, but I feel this is rather poor. I'd like to
ask the readers of this list for comments on how to make these examples
better. All help would be seriously appreciated.

Example for inclusion in ~/.profile:

#If there is an active ssh-agent kill it first (to remove stale onces)
if [ "$SSH_AGENT_PID" != "" ]; then
  ssh-add -D
  eval `ssh-agent -k`
fi
eval `ssh-agent`
ssh-add

Example for inclusion in ~/.login:

#If there is an active ssh-agent kill it first (to remove stale onces)
if ( "$SSH_AGENT_PID" != "" ) then
  ssh-add -D
  eval `ssh-agent -k`
endif
eval `ssh-agent`
ssh-add

Example for inclusion in ~/.xsession and ~/.xinitrc:

#Put this on a line where it is executed just before starting a
#Window Manager
exec ssh-agent sh -c 'ssh-add </dev/null'

I know about /etc/X11/Xsession.options and use-ssh-agent, but most of
the people that will be reading this are using Solaris, HP-UX and all
kinds of GNU/Linux distributions, so this must be as portable as
possible. Of course the above is for OpenSSH, but the same examples are
given further in the text adapted for use with SSH.com.

Thanks in advance for all comments.

Grx HdV





Reply to: