Site icon New Generation Enterprise Linux

Stop your SSH session from freezing when your laptop goes to sleep

SSH & Remote Administration

Stop your SSH session from freezing when your laptop goes to sleep

🧩 The Challenge

You know the pain of waking your laptop up after a meeting, only to find your SSH terminal totally dead and hanging. You end up mashing Ctrl+C for ten seconds before finally killing the window.

💡 The Fix

Just tell your client to poke the server every now and then so the connection stays alive even if there’s no active traffic. It stops those annoying timeouts dead in their tracks.

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

⚙️ Why It Works

Setting this makes the SSH client send a null packet to the server if nothing has been sent for sixty seconds, preventing intermediate firewalls or your own OS from dropping the idle connection.

🚀 Pro-Tip: Add ServerAliveCountMax 3 if your network is especially flaky.

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

0 0 votes
Article Rating
Exit mobile version