Stop your SSH session from dying when the coffee shop Wi-Fi blips

SSH & Remote Administration

Stop your SSH session from dying when the coffee shop Wi-Fi blips

🧩 The Challenge

There is nothing worse than having a massive file transfer or a long-running diagnostic script get nuked just because your laptop went to sleep or the local network hiccuped for three seconds. You end up staring at a frozen cursor, wondering if you actually finished that config update or if you just corrupted the whole partition.

💡 The Fix

Just add a couple of settings to your local config file to keep the connection heartbeat alive even when there’s no traffic. It effectively turns your SSH client into a persistent listener that refuses to give up on the server.

Host *
ServerAliveInterval 60
ServerAliveCountMax 3

⚙️ Why It Works

Setting the interval forces the client to send a null packet every minute, and the count ensures the connection doesn’t drop unless the server fails to respond three times in a row. It is a set-and-forget fix for those annoying ghost sessions.

🚀 Pro-Tip: Stick this in your ~/.ssh/config and you’ll never have to worry about broken pipes during a meeting again.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted