Site icon New Generation Enterprise Linux

Stop fighting SSH connection timeouts when the network is flaky

SSH & Remote Administration

Stop fighting SSH connection timeouts when the network is flaky

đź§© The Challenge

Dealing with a connection that drops every time your laptop switches Wi-Fi or the VPN hiccups is absolute torture. Half the time I end up staring at a frozen cursor, wondering if the server is down or if my SSH session just gave up the ghost.

đź’ˇ The Fix

Tell your SSH client to send keepalive signals in the background so the connection stays open even when there isn’t any active traffic. It’s a set-and-forget fix for those irritating “Broken pipe” errors.

echo "ServerAliveInterval 60" >> ~/.ssh/config && echo "ServerAliveCountMax 3" >> ~/.ssh/config

⚙️ Why It Works

By cranking these settings up, your client sends a null packet to the server every minute to make sure the tunnel is still alive. If the server doesn’t respond after three tries, the client finally disconnects gracefully instead of hanging your terminal indefinitely.

🚀 Pro-Tip: Keep the interval at 60 seconds; anything lower and you’re just spamming your own network for no reason.

Linux Tips & Tricks | © ngelinux.com | 8/28/2026

0 0 votes
Article Rating
Exit mobile version