keeping an idle SSH connection alive
I've noticed that a long running SSH session is getting unresponsive after lacking input for a certain period. The culprit seems to be my ISP that kills idle connections for some reason. The fix is simple - set up keep-alive by editing /etc/ssh/ssh_config and adding this:
- Host *
- ServerAliveInterval 15
- ServerAliveCountMax 4
Now the ssh client will ask the server for a sign of life every 15 seconds thus keeping the connection open. As an added bonus, if the server fails to respond 4 times in a row the client gives up and closes the connection itself.
Category: Linux



Leave a Comment :
Leave a Comment