Never use a passwordless SSH key. Ever.

Though on my own laptop I get a bit lazy and like to use a keychain to remember my SSH key password so I don’t always have to fetch it from my password safe.

This is how I do it. Don’t do this on any internet available instance.

Install keychain

$ sudo apt-get install keychain

Configure keychain

I will assume you already have your own SSH keys. So let’s configure that keychain. I prefer vim:

$ vim $HOME/.bashrc


$ vim $HOME/.bash_profile

Then add the following lines:

/usr/bin/keychain $HOME/.ssh/id_rsa
source $HOME/.keychain/$HOSTNAME-sh

Checkout the --clear option on the keychain command if you want to make things more secure.

The next time you start your shell, you will enter your SSH password, and from then on you should see something like this:

 * keychain 2.8.5 ~
 * Found existing ssh-agent: 9999
 * Known ssh key: /home/user/.ssh/id_rsa