3 ms·
I liked the article but I thought he spent too much time on getting the hostname short. Just install bash_completion and then all ssh/network stuff starts compl
by __david__ 16y ago
I liked the article but I thought he spent too much time on getting the hostname short. Just install bash_completion and then all ssh/network stuff starts completing based on your known_hosts. His "annoying.hostname.example.com" becomes "ssh ann<tab>" which is still shorter than anything he had there.
I'm glad he did mention my favorite config file option for setting the username:
Host example.com
User = someweirduser
That way I don't have to remember to "ssh someweirduser@example.com" because some client set up a weird user for me--I just "ssh example.com" instead.
- jcsalterego 16y agoYeah, 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 :)
- mcmatterson 16y agoSmall 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.
- thristian 16y agoModern 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.