SSH & Remote Administration
Stop being kicked off your SSH session just because you paused for coffee
🧩 The Challenge
You finally get deep into a multi-step database migration and your terminal just freezes because you stepped away to grab a drink. Nothing is more infuriating than coming back to find a broken pipe error and wondering if your transaction actually committed.
💡 The Fix
Change the keep-alive interval so your client periodically pings the server, keeping the connection warm even when you aren’t typing. It’s the simplest way to prevent those annoying drops from firewalls or idle timeouts.
echo "ServerAliveInterval 60" >> ~/.ssh/config
⚙️ Why It Works
Setting this makes your SSH client send a null packet to the server every minute, which resets the idle timer on any middlebox trying to kill your connection. It’s a lifesaver for long-running sessions over spotty VPNs.
🚀 Pro-Tip: Add ServerAliveCountMax 3 to the same config block so it only kills the connection after three missed pings if the host actually goes offline.
Linux Tips & Tricks | © ngelinux.com | 10/7/2026
