What does the ServerAliveCountMax in SSH actually do?
I am trying to ensure that when I connect to my server via SSH that the connection remains open for a long period of time instead of the connection dying after a short period of inactivity. This is the example
Host *
ServerAliveInterval 60
ServerAliveCountMax 2
I've heard from one source that the above setting will always send a response to the server every 60 seconds so long as the server receives that response. However if for whatever reason the response doesn't go through to the server, it will try and send another message. If that message fails too, then it will close the connection. (I feel this is wrong)
The second and third source however say something different. They claim that a message will be sent to the server every 60 seconds if there is a period of inactivity, but it will only send through 2 requests and then it will close the connection.
So what exactly does ServerAliveCountMax do?
Best Answer
Your feeling that "this is wrong" is correct. See the man page: