Site icon New Generation Enterprise Linux

Stop letting your SSH sessions die in the middle of a long config task

SSH & Remote Administration

Stop letting your SSH sessions die in the middle of a long config task

🧩 The Challenge

You know that feeling when you’re midway through editing a massive firewall rule set and your connection drops because your home internet blipped for three seconds? It’s enough to make you want to throw your keyboard out the window.

💡 The Fix

Just tell your SSH client to keep the connection alive by sending a heartbeat packet in the background, so your session stays open even when things go quiet.

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

⚙️ Why It Works

Setting this value sends a null packet to the server every sixty seconds to keep the socket active, preventing intermediate firewalls or your router from killing an “idle” session.

🚀 Pro-Tip: Stick a ServerAliveCountMax 3 in there too so it actually gives up if the server is truly dead.

Linux Tips & Tricks | © ngelinux.com | 10/17/2026

0 0 votes
Article Rating
Exit mobile version