So I'm working on a little SSH call back solution for one of my boxes, and I'm having a slight problem that I barely know what to even look up to figure out what's going on.
Basically, the client connects back over SSH and checks every 60 seconds if the connection is still active, using
netstat. However, if the server reboots, and I check netstat, the connection still shows there. So I'm basically wanting to make sure that the client can keep an SSH connection alive (even if it's not being used) for a long time, but if the connection actually terminates from the server, I want the client to be able to drop the connection.
What options on the client, if not the server, should I be looking at to make sure stale/dead SSH connections are actually dropped while making sure that I can have a persistent SSH connection for future access?
I thought it may have been setting the ClientAliveInterval and ClientAliveCountMax, but I'm not sure if I need to set this on the client, or the server, and how the client would know it's disconnected if it's to be set on the server.