Stop letting your SSH session choke on idle timeouts

SSH & Remote Administration

Stop letting your SSH session choke on idle timeouts

🧩 The Challenge

Nothing ruins my focus like trying to jump back into a terminal window after a quick coffee, only to find the session dead because a load balancer or local firewall decided to drop the connection. I’ve wasted hours staring at a frozen cursor thinking a server was down when it was just ghosting me.

💡 The Fix

Tell your local client to send a keep-alive packet to the server every so often so the connection stays warm even when you aren’t typing. It’s a lifesaver for long-running sessions across flaky corporate VPNs.

echo "ServerAliveInterval 60" >> ~/.ssh/config

⚙️ Why It Works

Setting this interval forces your client to send a null packet to the server every minute, which prevents intermediate network devices from nuking your session out of boredom. It keeps the pipe active without you having to touch the keyboard.

🚀 Pro-Tip: Combine this with ServerAliveCountMax 3 to force a hard disconnect if the server actually goes silent for three consecutive probes.

Linux Tips & Tricks | © ngelinux.com | 11/12/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted