Quantcast
Channel: How To – Paul K Leasure
Viewing all articles
Browse latest Browse all 39

How to use multiple ssh keys for different accounts

$
0
0

I wanted to have multiple rsa keys for various different hosts to help prevent hidden connection issues.

Issues may arises when an rsa key is changed on one host that may have been used on another host effectively severing the connection without your knowledge.

By having different rsa keys when dealing with a host that is critical, one may prevent this.

The ~/.ssh/config file (on your local machine) can be edited so that it will refer to different ssh keys for different hosts.

Open the ~/.ssh/config file in a plain text editor. Then make modifications like this:

...

# RSA Key for all accounts not specified below
Host *
IdentityFile ~/.ssh/id_rsa

# RSA Key for DigitalOcean account
Host *.digitalocean.*
IdentityFile ~/.ssh/digitalocean_rsa

Note that these are NOT the public key but the private key.

Save the file and now you computer will use the appropriate key when visiting a host.


Viewing all articles
Browse latest Browse all 39

Trending Articles