Site icon New Generation Enterprise Linux

Stop getting locked out when your ssh session times out

SSH & Remote Administration

Stop getting locked out when your ssh session times out

đź§© The Challenge

Dealing with those annoying connection drops just because you stepped away to grab a coffee for ten minutes is a total productivity killer. Half the time the terminal just hangs there like a zombie until you finally kill the window.

đź’ˇ The Fix

Just bake some keepalive settings into your local ssh config so the client actively pings the server to keep the session alive. You’ll never have to reconnect manually after a quick break again.

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

⚙️ Why It Works

Setting these parameters forces the client to send a null packet to the server every minute, ensuring the connection doesn’t look idle to your home router or the server’s firewall. It basically tricks the network gear into thinking there’s actual traffic flowing.

🚀 Pro-Tip: Add the same logic to your server-side sshd_config if you want to be a good coworker and keep your sessions from timing out on you.

Linux Tips & Tricks | © ngelinux.com | 7/14/2026

0 0 votes
Article Rating
Exit mobile version