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

TextExpander → Alfred 3.x

That’s a long overdue I wanted to write about. TextExpander creators, Smile Software, announced back in April, 2016 they moved to subscription model. Although after an overwhelming response from the TextExpander users, the company... Continue →