Next Previous Contents

6. Using ssh-agent to manage your keys

6.1 ssh-agent

But what if i use two keys, or three or a hundred. But what if I use the keys several times after each other, it sucks to have to enter my "l33t and strong" passphrase.

Okay, thats what ssh-agent is for. The little program ssh-agent does you a favor by managing your keys for you. You enter the passphrase once, and after that, ssh-agent keeps your key in its memory and pulls it up whenever it is asked for it.

To use the agent first start it. Just enter "ssh-agent bash" and thats all. This will put you in a bash shell which is spawned by ssh-agent. After that you'll need to add your key. To do this enter the command "ssh-add". This will try and add the standard key "identity" to the key manager. To add a key with a different name, enter "ssh-add /location/of/key". After this, the ssh-add program will ask you for your passphrase. After you entered your password the key is loaded in the key manager ssh-agent.

You can test this by logging into the server you put your public key on. If the key is correctly loaded in the ssh agent it wont ask you for your passphrase and log you in. ("ssh -v host.with.pubkey").

Also you can have a look at your currently loaded keys by using "ssh-add -l".

After you logged in, log out by typing "logout". After this, try and login again, using "ssh -v host.with.pubkey" again. Again it wont ask you for your passphrase, because the ssh-agent does this for you.


Next Previous Contents