2025-12-31:

~/.ssh/config and includes

It’s kind of obvious that using .ssh/config separates a skilled Linux user from a wannabe kubuntu user.

And how could it not? You can set the username, port, and key (oh yes, you can use different keys for different services), and all those weird host parameters once and then forget about them.

And aliases:

$ cat ~/.ssh/config

Host ffwe_blog HostName fire-fart-water-earth.net IdentityFile ~/.ssh/keys/private_key User blog WarnWeakCrypto no

$ ssh ffwe_blog

Typically, after some time, ~/.ssh/config becomes a disgusting list of dead hosts and removed keys. And you can’t really do anything about it. The dual nature of ~/.ssh/config.

But today is a magical day, and I have incredible news for you! ~/.ssh/config supports includes! (did no one read the manual at all?) So you can split your huge garbage pile into neat, organized pillars!

$ cat ~/.ssh/config

SetEnv EDITOR=vim ServerAliveInterval 30

Include ./conf.d/my_hosts Include ./conf.d/work_hosts

$ cat ~/.ssh/conf.d/my_hosts

# for syntax highlighting
# vi: ft=sshconfig

Host ffwe_blog
    HostName fire-fart-water-earth.net
    IdentityFile ~/.ssh/keys/private_key
    User blog
    WarnWeakCrypto no

You are welcome! Live better than you lived before!

#ssh #linux