How To Organize and Use Multiple RSA Keys On Local Machine?

Solution 1:

You could use command-line options as jdw says, but the saner option is to configure ssh so that it knows to do this automatically.

Create or edit your ~/.ssh/config file and add the following:

Host Server_A
    IdentityFile ~/.ssh/server_A

Host Server_B
    IdentityFile ~/.ssh/server_B

Host Server_C
    IdentityFile ~/.ssh/server_C

Now whenever you ssh/scp to those servers, it will use the respective private key.

Solution 2:

Personally, I just name them appropriately. The old default of id_rsa certainly gets confusing. I name them so I know what they are for:

~.ssh/foo.com
~.ssh/foo.com.pub

I put foo.com.pub onto foo.com, then when I am connecting to foo.com, I use something like this:

ssh foo.com -luser -i~.ssh/foo.com

Or, in your case, something like

ssh Server_A -lusername -i/Users/username/.ssh/server_A