I’m the type of geek that has an SSH client open at all times, connected to my most frequently used servers so that I have instant access for monitoring and anything else. As such, it irritates me greatly when I get disconnected, so I’m sharing a few methods for keeping your session alive.
You can configure the ssh client to automatically send a protocol no-op code code every number of seconds so that the server won’t disconnect you. This is setting is sometimes referred to as Keep-Alive or Stop-Disconnecting-So-Much in other clients.
Add the following line to the /etc/ssh/ssh_config file:
The number is the amount of seconds before the server with send the no-op code.
Current User Configuration
Add the following lines to the ~/.ssh/config file (create if it doesn’t exist)
Make sure you indent the second line with a space.
If you only want to enable keep alive for a single server, you can add that into the ~/.ssh/config file with the following syntax:
Works quite well, hope it helps somebody else out there.
- › Stop Listening to Celebrity Advice on Crypto (and Everything Else)
- › How to Get More Dynamic Range from Your Photos
- › How to Spot a Fraudulent Website
- › How-To Geek Is Looking for a Future Tech Writer (Freelance)
- › GORILLA.BAS: How to Play the Secret MS-DOS Game From Your Childhood
- › How to Set Up Dual Monitors in Windows 11