Make your SSH connections instant after the first one
SSH & Remote Administration
Make your SSH connections instant after the first one
🧩 The Challenge
You’re logged into a remote host, do some work, log out. Then you remember something, log back in. Maybe you’re running multiple commands, bouncing between them. Each time, there’s that little wait, that fresh handshake, that slight delay. Man, that adds up to wasted mental energy and, eventually, hours.
💡 The Fix
There’s a simple, killer trick for your SSH client config that keeps a connection alive in the background. It means every subsequent connection to that same host becomes basically instant, no re-authenticating or waiting needed. You’ll wonder how you lived without it.
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h:%p
ControlPersist 15m
⚙️ Why It Works
This setting tells your SSH client to create a persistent master connection (that’s the `ControlMaster auto` part) and then funnel all other connections to the same host through it. `ControlPersist` keeps the master connection socket alive for 15 minutes after you’ve closed all your sessions, so it’s ready for your next command.
🚀 Pro-Tip: For hosts you connect to constantly, change `ControlPersist` to `yes` to keep the master connection alive indefinitely.
Linux Tips & Tricks | © ngelinux.com | 11/29/2026
