Using a Key Agent
To avoid having to give your passphrase each time you use ssh, you can use an ssh key agent. Such an agent typically is started when you login to your local client, asks for the passphrase only once and uses that passphrase each time it is needed to decrypt the (private) key to contact remote servers with.
On the Linux machines of the Department of Computer Science,
such an ssh key agent is automatically started when you login
to an X11 session.
For Microsoft Windows, pageant (part of the
PuTTY suite) is considered
an excellent key agent.
And also on MacOS there is without a doubt an excellent solution available.
On computers where such a key agent is not started automatically, a typical use is in combination with an X11 session startup file like .xsession. Rename your old .xsession to .xsession.ssh and create a new .xsession file (make sure this new file is executable !) with the following contents:
-
exec ssh-agent ${HOME}/.xsession.ssh
You must execute ssh-add to make your identity known to the key agent. A single key agent can manage multiple identities. Consult the man page if you need to know more about multiple identities.
To execute ssh-add each time you log in, all you need to do, is to add the ssh-add command to your startup file/environment as indicated below. For a traditional X11 session (using a window manager like fvwm) this would be your .xsession file, for KDE or GNOME you need to create a command in the (KDE or GNOME) Autostart directory.
In the .xsession file, add the following line to the beginning:
(or the .xsession.ssh if you needed to rename it as described above)
-
ssh-add < /dev/null
In KDE, right click on your desktop and create a new link to application containing the ssh-add command. Move or copy this newly created icon to the Autostart directory.
The ssh-add command presents a small X window in which you must type in your passphrase.
In this way, everytime you login to your local computer, it asks for the passphrase of your (default) identity and remembers it for the rest of your session, such that you need not enter it again, when using ssh.

