/ Mostly Unixish

SSH hostnames configuration and shortcuts

This is another old trick, but I like to tell the world about such amenities.

I often find people writing command lines such as:

ssh arcane-system-user@someextremelylong.andimpossibiletotype.anderrorprone.hostname.com

or, worse

ssh idliketorememberwhichuser@10.20.30.40

or maybe it was

ssh someuserimashamedof@1.2.3.4

yes, sometimes ssh is simply tedious.

But you can do better. In fact, you can do much better.

your ~/.ssh/config or /etc/ssh/ssh_config can contain Host configuration sections; I have already blogged about such directives when I told the world about stopping key verification compliants - they're very flexible, indeed.

Consider adding Host directives in your configuration for your most used services:

Host myniceserver
    Hostname myniceserver.mylove.com
    Port 12345
    User teddybear

And then you can just

ssh myniceserver

You can override most options on a per-server basis and/or select a certain private key for connections.