I have many reverse ssh tunnels and because monitoring ports can't be reused, I am trying to find a free random port for monitoring. Meanwhile I specified -M 0 and the forwards work great and in most cases: when there is a disconnection, it will automatically reconnect. However, sometimes, on rare occasion, a connection will hang and think it is connected even if it has gone stale.Is it possible to setup a random monitoring port?What I tried: When I specify a port with -M [port] , I can't monitor more than one connect When I specify -M 0 and use ServerAlive, rarely the connection hangsI added ClientAlive in sshd_config and specify ServerAlive in the command lineBecause my reverse port forward occasionally becomes stale, it makes it unreliableThanks in advance
Specifying a random monitoring port with autossh
ssh tunneling;openssh;port forwarding