Keeping SSH sessions alive

I’ve faced a problem with breaking SSH sessions while working with my servers. The sessions kept breaking every time I switched from the terminal:

[root@i-deploy ~]# Write failed: Broken pipe

It mostly depends on timeout settings of the devices that are on the route from your terminal to the servers. The idea that is helping to resolve the issue is to send keep alive signals so the connection is not idle.

The SSH has the ServerAliveInterval (in seconds) and several places where you can specify it to achieve that. I’ll leave the detail description to the great screen cast and article describing the approach. It’s for Linux but works for Mac as well.

I stick with a rather intense setting for all the users on my Mac and used the client settings in /etc/ssh_config for that:

 Host *
   ServerAliveInterval 10
#   SendEnv LANG LC_*

It should be enough to have it 45 or even 60 for the most cases, though.

 
7
Kudos
 
7
Kudos

Now read this

Voice conversation using cloud →

In the Episode #106 of AWS podcast, Jeff Barr and David Isbitski had an interesting discussion on the Amazon Echo device and the Alexa Voice Service that resides behind it. It’s great we have another player on the scene that increases... Continue →