The SSH Authentication Agent
Richard Caley, 12th October, 2002

The ssh-agent program can be used to create store where you can keep private keys. Keys in this store will be available to ssh, scp and related programs. The advantage is that you are asked for your pass phrase to access a key just once, when it is put in the store, this gives the convinience of having a public-private key pair to allow access to other machines without giving a password without having a non-protected file on your machine which an intruder could copy and use to pretend to be you.

The following script can be used to start an ssh-agent when you log in, if necessary, or connect to an already running one. Putting it in your .bashrc to be called only when the shell is attached to a terminal will mean that every shell you run on a machine should have access to your keys.

Once you have and agent running you can also let scripts which may not be run from an interactive shell, for instance things run from cron or a window manager menu, have access to the keys. Put something like this at the top of your script:

Scripts with this at the top can then call ssh, and so long as there is a useful key in the agent's store, they will not need to prompt you for a passphrase.


Richard Caley / SSH Agent / 12 October 2002