Stop staring at a frozen terminal when your SSH session drops

SSH & Remote Administration

Stop staring at a frozen terminal when your SSH session drops

🧩 The Challenge

Your home VPN blips for a second, and suddenly your remote terminal is completely dead with zero feedback. You’re left hammering enter and waiting five minutes just to get your prompt back.

💡 The Fix

Configure TCP keepalives directly in your client config so dead connections drop instantly instead of hanging forever. It saves you from opening fresh tabs every time your coffee shop Wi-Fi hiccups.

echo -e "Host *\n ServerAliveInterval 15\n ServerAliveCountMax 3" >> ~/.ssh/config

⚙️ Why It Works

The client starts pinging the server in the background after fifteen idle seconds, and three failed responses kill the socket immediately.

🚀 Pro-Tip: Set this globally for all users in /etc/ssh/ssh_config so you never have to think about it again.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted