Stop killing your SSH sessions with idle timeouts
SSH & Remote Administration
Stop killing your SSH sessions with idle timeouts
🧩 The Challenge
Nothing ruins your flow quite like coming back to a server after lunch only to find your terminal session dead because some invisible timeout killed it. I’ve wasted so many minutes reconnecting and re-running commands because the connection just went stale.
💡 The Fix
You can tell your SSH client to send a keepalive packet periodically so the connection stays warm even when you aren’t typing. It’s a lifesaver for long-running debugging sessions or when you’re jumping through flakey remote links.
echo "ServerAliveInterval 60" >> ~/.ssh/config
⚙️ Why It Works
Setting this forces the SSH client to send a null packet to the server every minute if no data has been exchanged. The server treats this as activity, which keeps your session from getting dropped by aggressive firewall states or idle timeouts.
🚀 Pro-Tip: Add ServerAliveCountMax 3 if you want the client to be even more persistent before finally giving up.
Linux Tips & Tricks | © ngelinux.com | 9/21/2026
