Easier ssh with ~/.ssh/config

21 Jan 2021

I didn't know about the ~/.ssh/config file until quite recently and it's really handy, so I thought I'd share.

Here's a simple example:

Host nas

Hostname 192.168.1.10

Host laptop

Hostname 192.168.1.11

User laptop-me

Host someserver

Hostname 203.0.113.1

User seriousthings

Port 10100

PubkeyAuthentication yes

Identityfile ~/.ssh/id_rsa_seriousthings

Host *

PubkeyAuthentication no

I am then able to do, for example, simply:

ssh nas

These settings apply from top to bottom, cumulatively. So you want to structure this file with *specific rules above general rules*, otherwise the general rules will override the specific, which is not what you want.

One nice benefit is that you'll get autocompletion of hosts defined in `~/.ssh/config` when using ssh under bash or zsh (at least).

=> ssh tunnelling for fun and profit

=> ..

Proxy Information
Original URL
gemini://friendo.monster/log/ssh_config.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
227.608854 milliseconds
Gemini-to-HTML Time
0.476621 milliseconds

This content has been proxied by September (ba2dc).