mediatribe.net -- Drupal et développement web

Notice: this post was last updated Il y a 5 years 8 weeks so it might be outdated. Please be cautious before implementing any of suggestions herein.

Using more than one SSH private key

Say you have your regular SSH public-private key pair for most of what you do, and you need to have another SSH public-private key pair for specific servers (this doesn't happen often, but there are some edge cases where there is no easy alternative).

start by creating a new directory in your home folder, called .ssh-whatever, and put your public private key pair (or just your private key, that works too) in there.

Now, each time you want to access a server with the key in .ssh-whatever, type in "ssh-agent bash" followed by "ssh-add ~/.ssh-whatever/id_rsa". Now you will be able to access any server with the key in .ssh-whatever.