How To Use Multiple SSH Keys? – POFTUT

How To Use Multiple SSH Keys?

I work on  Ubuntu and want to use multiple ssh keys to connect different serves. I have tried some different method but unluckily they have failed. How can I use multiple ssh keys?

Multiple Hosts Multiple Keys

Ssh config resides in .ssh/config file in user home directory. The magic is here.

Hostname is the hostname of the remote system. While connecting to this system with IdentityFile ~/.ssh/cen1_rsa configuration makes to use cen1_rsa as key.

Multiple Keys Same Host

This is usefull alternative for key usage too. We want to use multiple keys for same host. As we know ssh is tries related keys for hosts in sequence. We can define new keys with Identity configuration like below

Here IdentityFile ~/.ssh/ubu1bak_rsa is added alternate private ssh for host ubu1.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)