In another article, Setup ssh login without password, I described how to quickly setup ssh access. In real cluster environment, quite offten, you need multiple private ssh keys, is there a easy way to use them?

Apparently the way to do this is use the comman

ssh -i ~.ssh/private_ssh_file_server1 This email address is being protected from spambots. You need JavaScript enabled to view it.

That is not a friendly way.

Here is a way, you can either configure it in /etc/ssh/ssh_config, which applys to system wide, or config it in ~.ssh/config

Here is the example:

Host           friendly-name_server1
IdentityFile   ~/.ssh/private_ssh_file_server1
User           username-on-server1

Host           friendly-name_server2
IdentityFile   ~/.ssh/private_ssh_file_server2
User           username-on-server2

Now you can connect using the friendly-name:

ssh friendly-name_server1

Remember to add privates to ssh_agent.



Comments powered by CComment