The ~/.ssh/config file was something I discovered when my my company was going through some changes and I had 2 different usernames for accessing internal systems.
Host hosta hostb hostc
User usera
Host *
User userb
Since my local system username was different than many of the remote systems I could wildcard to a different default username then had a list of servers that would use my other username.
The bad thing is, as the blog post shows, "Host" above is really just an alias. So if I have an entry like:
Host hosta.mycompany.com
User usera
and then try to do "ssh hosta", even if hosta resolves to hosta.mycompany.com, it won't match the config entry, as config entry data is all used prior to DNS lookup.
so, I would say that the easiest solution here is tab completion. Suitably modern bash-completion should expand entries in ~/.ssh/config (as well as ~/.ssh/known_hosts if its not hashed).
The bad thing is, as the blog post shows, "Host" above is really just an alias. So if I have an entry like:
and then try to do "ssh hosta", even if hosta resolves to hosta.mycompany.com, it won't match the config entry, as config entry data is all used prior to DNS lookup.EDIT: thanks for all the suggestions below.