Nov 10, 2018

How to configure multiple private keys to login to different servers

If you have two or more private keys for multiple servers and you wish to connect using multiple private keys, create ~/.ssh/config file, that contain following lines:

Host server1
User i88ca
IdentityFile /path1/server1.pem


Host serverN
User root
IdentityFile /pathN/serverN.pem

In Host, first name is short name that can be used with ssh command, for example:

$ ssh server1