SSH & Remote Administration
Stop your SSH sessions from hanging on bad networks
đź§© The Challenge
You know that feeling when you’re on a spotty public Wi-Fi or tethered to a phone, and your terminal just suddenly stops responding to keystrokes? Then you sit there hitting enter for a minute like an idiot hoping it’ll snap back to life, but it’s already dead.
đź’ˇ The Fix
Just tell your SSH client to send a keepalive packet every few seconds. It makes the connection way more resilient and helps you spot a dead session instantly.
echo "ServerAliveInterval 15" >> ~/.ssh/config
⚙️ Why It Works
By sending a small packet at regular intervals, the client detects a broken pipe before your shell goes totally non-responsive. It forces the connection to timeout cleanly so you can get back to work instead of staring at a frozen cursor.
🚀 Pro-Tip: Add ServerAliveCountMax 3 to the same file if you want it to be even more aggressive about cutting ties when the connection vanishes.
Linux Tips & Tricks | © ngelinux.com | 7/22/2026
