Stop your SSH sessions from timing out when you are mid-thought
SSH & Remote Administration
Stop your SSH sessions from timing out when you are mid-thought
🧩 The Challenge
You finally get deep into a multi-step database migration, get distracted by a Slack message, and return to find your terminal session is frozen solid. There is nothing worse than realizing your active work got nuked because your connection went idle for five minutes.
💡 The Fix
Just configure your client to send a keep-alive packet at regular intervals so the firewall doesn’t drop the connection out from under you. It is a set-it-and-forget-it fix for that annoying dropped pipe error.
echo "ServerAliveInterval 60" >> ~/.ssh/config
⚙️ Why It Works
Setting this interval tells your local SSH client to poke the server every minute if there hasn’t been any traffic, which keeps the connection state alive in any grumpy stateful firewalls sitting in between.
🚀 Pro-Tip: Add ServerAliveCountMax 3 if you want the client to be extra patient before giving up entirely.
Linux Tips & Tricks | © ngelinux.com | 7/18/2026
