Keeping Cygwin SSH session alive

5

2

I'm having the a bit of a problem with accessing remote RedHat servers from a Windows machine using Cygwin SSH client.

What I do is I run some fairly time-consuming QA scripts on the remote RedHat machine by logging in from home Windows machine. At the client end I use Cygwin SSH in an ordinary Cygwin console window. As long as I'm working interactively (i.e. executing commands from the command line) everything is fine. When I start the script, everything works fine as well as long as the script produces any visible activity on the terminal, i.e. as long as it prints something to the screen. But if there's is a significant pause in the output, the connection to the RedHat machine eventually gets dropped with "Write Failed: Connection reset by peer" message.

Is this some sort of timeout/keep-alive issue? And if so, what do I have to configure to stop this from happening? And where (server side or client side)?

AnT

Posted 2013-06-26T17:17:00.043

Reputation: 876

Question was closed 2013-06-28T22:17:34.907

I had a problem with keepalive not working in Cygwin and I fixed it by downgrading ssh from 8.0 to 7.9 – PhilHibbs – 2019-04-29T16:27:42.737

Answers

5

Modify the timeouts:

Configure the server

Open up /etc/ssh/sshd_config and find the ClientAliveInterval option (if it’s not there, add it). The value is in seconds, so I went with 540 seconds, or 9 minutes.

ClientAliveInterval 540

Configure the client

Edit /etc/ssh/ssh_config and find the ServerAliveInterval option (if it’s not there, add it). Again, this value is in seconds, so a 9-minute interval is 540 seconds.

ServerAliveInterval 540

Also, autossh can be your good friend.

dtmland

Posted 2013-06-26T17:17:00.043

Reputation: 2 281

2

It most likely is a timeout; to prevent it from occurring, you can use the following setting in ~/.ssh/config

ServerAliveInterval <keepalive-interval>

to send a keepalive packet every <keepalive-interval> seconds.

Aaron Miller

Posted 2013-06-26T17:17:00.043

Reputation: 8 849

1

I sure that this and this links will be helpful.

september

Posted 2013-06-26T17:17:00.043

Reputation: 529

2

Please see Are answers that just contain links elsewhere really “good answers”? Thanks!

– Arjan – 2013-06-29T11:48:43.197