Re:Getting Comfortable With SSH
by mcmatterson on Saturday February 05, 2011 @05:10PM
(#2184229)
Small point: the syntax of .ssh/config doesn't use equal signs; the actual format of that stanza would be
Host example.com
User someweirduser
Another subtle point about SSH config -- only the first matching entry (in top-to-bottom order) for a given parameter is taken from .ssh/config. If you have multiple Host entries that match for a given hostname, the first matching User, Port, etc, entry will be the one that ssh uses.
Re:Getting Comfortable With SSH
by jcsalterego on Saturday February 05, 2011 @04:31PM
(#2184138)
Yeah, the example is more for hyperbolic illustration than anything else. My actual use case is that I've got a lot of IP addresses, different usernames and non-standard ports across various servers, so it's incredibly convenient to have my .ssh/config all set up.
With aliases (and zsh completion support for aliases), I can do "ann<tab>" which saves me even more time.
It won't be long before all I have to type is tab :)
Modern versions of ssh support the "HashKnownHosts" file which prevents people from discovering what hosts you have ssh'd to in the past - and, as a side effect, prevents tab-completion from discovering what hosts you have ssh'd to as well. ssh_config(5) says the option is disabled by default, but Ubuntu at least enables it in /etc/ssh/ssh_config.
I'm glad he did mention my favorite config file option for setting the username:
That way I don't have to remember to "ssh [email protected]" because some client set up a weird user for me--I just "ssh example.com" instead.