And the “new trick of the week” award goes to… SSH configuration files.
I’ve been an OpenSSH user for a LONG, LONG time. I’ve used lots of different configuration, and connected to probably hundreds of hosts. No, I don’t use a GUI interface. Yes, I prefer scp to just about any other remote copying tool. I pretty much thought I knew it all.
Turns out there was an elephant-sized hole in my SSH knowledge. One of my colleagues at Palantir.net showed me his .ssh/config file.
Now, several years ago I put a few directives in one of those things, but thought nothing else of it. But a split-second glance at his configuration made me drool. He had almost a dozen hosts configured in there, allowing him to type things like this:
$ ssh example
Meanwhile, I was typing:
$ ssh email@example.com -i my_key_file
And my error-prone fingers rarely get the right username, hostname, and identity file.
Heading over to man’s best friend (that’d be man ssh_config), I quickly loaded up my .ssh/config file with entries that look like this:
Now I can connect to the first one with a simple
$ ssh dev
, after which I will be prompted for a password. Likewise, for the second one,
$ ssh github
I wish you success!