Stop letting your SSH sessions die the moment you stop typing
SSH & Remote Administration
Stop letting your SSH sessions die the moment you stop typing
🧩 The Challenge
You know the drill. You open a terminal to debug a production issue, get distracted by a Slack message, and return to find your connection frozen solid.
💡 The Fix
Just tell your SSH client to send a tiny heartbeat to the server every so often. It keeps the connection alive even when the network gets twitchy or your home router decides to drop idle states.
echo "ServerAliveInterval 60" >> ~/.ssh/config
⚙️ Why It Works
Setting this directive forces your local client to send a null packet to the server at the defined interval, preventing NAT timeouts from killing your session. It’s a set-and-forget fix that saves you from constantly reconnecting.
🚀 Pro-Tip: Add ServerAliveCountMax 3 to stop it from hanging forever if the server actually does go down.
Linux Tips & Tricks | © ngelinux.com | 10/21/2026
