I finally took time to set up my SSH properly. Due to the nature of my setup, I needed to use non-default ssh ports.

Kind of annoying, isn’t it? You have to specify the port ever time you connect, like so:

ssh user@host -p port

Worse even, if you have multiple ssh certificates, you need to specify that as well!

Luckily this problem has a very easy solution :)

SSH Configs

You can create a config file at ~/.ssh/config and save your frequent connected servers there.

For example, I have this entry in my config:

Host homeserver
    HostName ssh.x77.dev
    Port 42069
    User brimbly
    IdentityFile ~/.ssh/homeserver

So instead of connecting with

ssh brimbly@ssh.x77.dev -p 42069 -i ~/.ssh/homeserver

I can just connect like this:

ssh homeserver

I hope this is news to at least one person, just found this out after years of using ssh (: