Site icon New Generation Enterprise Linux

Fix those annoying SSH idle timeouts for good

SSH & Remote Administration

Fix those annoying SSH idle timeouts for good

🧩 The Challenge

Everyone knows the pain of SSHing into a production box, only to have the connection drop the second you look away for a coffee. It is maddening when you are halfway through a debug session and suddenly you are just staring at a frozen cursor.

💡 The Fix

You need to tell the client to poke the server every few minutes so the firewall doesn’t kill your session for being too quiet. This stops the connection from ghosting you.

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

⚙️ Why It Works

Setting this value sends a null packet to the server if no data has been received for the specified number of seconds. Because the connection looks active to any stateful firewalls in the middle, they won’t go and kill your session.

🚀 Pro-Tip: Add ServerAliveCountMax 3 to prevent it from hanging forever if the remote server actually dies.

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

0 0 votes
Article Rating
Exit mobile version