So, I'm wondering about some specific behaviour of my SSH daemon when using Clientaliveinterval and Clientalivemaxcount.

Assume the following config:

Clientaliveinterval 60 Clientalivemaxcount 0

Also assume the following other parameters:

  • Server OS: Debian Stretch-based (Proxmox VE 5)
  • Client OS: Windows 10 64-bit
  • Connecting with: WinSCP and Putty

The described settings above should disconnect my client after 60 seconds without sending packets. Now, this works when it comes down to my WinSCP-session. But why does this not work for Putty?

EDIT: See my own answer on this for describing what was wrong and how to fix it.

  • Do you happen to have Keep alives turned on, it's under 'connections' in putty? – djsmiley2k Dec 18 '17 at 13:15
  • Thanks, @djsmiley2k. I added an answer that describes what I did to fix that issue. – CuttingWide Dec 18 '17 at 15:04

Thanks to the comment from djsmiley2k that brought me to the right track!

I'ld like to explain what was wrong in my case (as it's not that obvious in the first place, I think), so it might help others.

  1. After logging in I started a Putty session from inside WinSCP.
  2. I waited the specified time and after 60 seconds the WinSCP-session got disconnected.
  3. However, my Putty session was still working.
  4. Right click on the Putty terminal window --> Change Settings --> Connection
  5. I now noticed that there's a value of 30s set for Seconds between keepalives.
  6. After manually setting this to 0, I got disconnected after the defined timeframe as expected.
  7. However, when reconnecting the same behaviour occured again.

From WinSCPs official documentation on that:

By default, WinSCP creates temporary site settings for PuTTY (under the name >"WinSCP temporary session”). The site settings will contain only the options >known by WinSCP, mostly connection options. It will particularly lack any >terminal options, so the defaults will apply. To change the defaults, modify >the “Default Settings” profile in PuTTY.

If you want to configure your own session-specific options, you can save PuTTY >site settings with the same name as a WinSCP site. WinSCP will then instruct >PuTTY to open that session (It will not export any settings, nor a connection >options).

To fix this behaviour:

  1. Open Putty (outside of WinSCP).
  2. Load the special session WinSCP temporary session
  3. Go to Connection
  4. Check that the keepalives-value is set to 0.
  5. Go back to Session
  6. Save the configuration under the same name as your Session name in WinSCP.
  7. Now try again and you should find out both the WinSCP and the Putty connection are terminated as expected.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.