Managing SSH keys

If you often use SSH, you can be tired to type your password each time. The solution is to use passphrases and to manage theme.

Generating a passphrase

First, check your ~/.ssh. If it is empty, you will need to generate a passphrase. For that, do :

$ ssh-keygen -t 

And follow the instructions. Then you need to send your public key (by default ~/.ssh/ to the server. Do not send you private key !!!

$ scp .ssh/ mylogin@myserver:

Then connect to the server and add it to the list:

$ cat >> .ssh/authorized_keys

Then logout and try again to connect to the server. Now it should ask for your passphrase.

Managing passphrases (1)

If you are only using one terminal, the easiest solution is to do the following:

$ eval `ssh-agent`
$ ssh-add

Enter your passphrase once and it will not ask for it again.

Managing passphrases (2)

On the contrary, if you often switch between several terminals, you will need a manager starting each time you open a new terminal. For that, follow the excellent instructions of Gentoo for keychain.