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:


or, worse

ssh idliketorememberwhichuser@

or maybe it was

ssh someuserimashamedof@

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
    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.