I’m pretty bad at remembering IP addresses, and I’m too lazy to type the same URLs over and over again. Such mundane tasks as connecting to my servers through SSH should involve as little typing as possible. My mind immediately started hacking a ruby script to handle that, but I managed to stop it just in time. Phew.
SSH has been around a while, I thought. There must be a configuration for that!
ssh_config comes to the rescue…
In addition to command-line arguments, SSH reads configuration from
This is a simple configuration:
It instructs SSH to connect to the hostname
www.example.com when you type
When managing my servers, I need to connect as different users and with different RSA keys. This is the kind of configuration I use:
1 2 3 4 5 6 7 8 9 10 11 12
ssh h1 or
ssh h1r will connect to
example1.com either as an unprivileged user or as root with a different identity file.
ssh h2 will connect to
example2.com on a custom port.
And it’s not limited to hostnames, user names and ports.
There are a lot of other configuration parameters for authentication, compression, etc.
I’ve been using this for years now. It makes me feel better at every SSH connection, knowing that I’ve saved a dozen characters. May the holy keyboard be with you.
- ssh_config: Linux man page