Site icon New Generation Enterprise Linux

Stop SSH from feeling like it’s frozen when your internet blinks

SSH & Remote Administration

Stop SSH from feeling like it’s frozen when your internet blinks

🧩 The Challenge

You know that feeling when you’re midway through a long migration, your home Wi-Fi stutters for a second, and your SSH session just hangs there like a zombie? You end up stuck with a dead terminal that won’t even accept an exit command, forcing you to kill the process and pray the database transaction finished.

💡 The Fix

Throw some keepalive settings into your local ssh config so the client aggressively checks if the server is actually still there. It’ll kill the connection instantly when the network dies, saving you from staring at a ghost session for twenty minutes.

echo "ServerAliveInterval 15" >> ~/.ssh/config
echo "ServerAliveCountMax 3" >> ~/.ssh/config

⚙️ Why It Works

Setting these parameters forces the SSH client to send a null packet every 15 seconds, and if it fails to get a response three times, it shuts down the pipe automatically. You stop wasting memory on stale file descriptors and can immediately reconnect to pick up where you left off.

🚀 Pro-Tip: Add IdentityFile ~/.ssh/id_rsa to that same config block while you’re at it so you don’t have to keep telling SSH which key to use.

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

0 0 votes
Article Rating
Exit mobile version