Tame your wild SSH connections
SSH & Remote Administration
Tame your wild SSH connections
🧩 The Challenge
Ever found yourself typing out a ridiculously long SSH command? Like, specifying a custom port, a different username, and a specific identity file, all just to hit one particular server. And then you do it again five minutes later, maybe hitting ‘up’ arrow but still adjusting the IP or the key. It’s a pain, and nobody tells you there’s a better way early on.
💡 The Fix
There’s a simple text file right in your ~/.ssh directory that can make all that go away. Define your connections once, give them short names, and just connect like it’s a local alias. You’ll wonder how you ever managed without it, cutting down on typos and saving a ton of time.
# ~/.ssh/config
Host dev-api-backend
Hostname 192.168.1.100
User svcuser
Port 2222
IdentityFile ~/.ssh/id_rsa_dev_backend
Host prod-web
Hostname webserver-01.prod.example.com
User deploy_user
IdentityFile ~/.ssh/id_rsa_prod_main
ProxyJump jumpbox.example.com # You can even chain through jump boxes!
Host *
ServerAliveInterval 60
ServerAliveCountMax 3
⚙️ Why It Works
The SSH client reads this config file first, looking for a matching Host entry. When it finds one, it automatically applies all the parameters you’ve defined for that specific connection. This means you type ssh dev-api-backend, and it knows exactly what IP, user, port, and key to use, without you lifting another finger.
🚀 Pro-Tip: Permissions on ~/.ssh/config should be 600 (user read/write only). SSH will complain if they’re too permissive.
Linux Tips & Tricks | © ngelinux.com | 9/24/2026
