Site icon New Generation Enterprise Linux

Stop your SSH sessions from timing out when you walk away

SSH & Remote Administration

Stop your SSH sessions from timing out when you walk away

đź§© The Challenge

You’re deep into a configuration file, get pulled into a meeting, and come back to a frozen shell that’s been dropped by your corporate firewall. It is incredibly annoying to reconnect and find your pager session or vim buffer left in a weird state.

đź’ˇ The Fix

Tell your local client to send heartbeat signals to the server every few minutes so the connection stays alive even if you’re not typing. It’s a total lifesaver for long-running sessions or unstable network paths.

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

⚙️ Why It Works

Setting this interval forces the SSH client to send a null packet to the server if no data has been exchanged for a minute, preventing intermediate firewalls from aggressively closing your idle state.

🚀 Pro-Tip: Add ServerAliveCountMax 3 to that same block to give it a bit more grace before the client gives up and dies.

Linux Tips & Tricks | © ngelinux.com | 11/4/2026

0 0 votes
Article Rating
Exit mobile version