Home » Odeon Blogs » Stefan Talpalaru, CTO »

keeping an idle SSH connection alive

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:

  1. Host *
  2. ServerAliveInterval 15
  3. 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 :

(required)


(required)




(required)




(required)






Leave a Comment


Page generated in: 0.13s