This is the situation:I have a Linux server running Ubuntu server 14.04 to which multiple computers connect and authenticate with SSH and try to open a reverse tunnel. These computers usually do not have a very stable internet connection and sometimes they will attempt to reconnect while the Linux server still thinks the old session is still open. What will happen then is that the computer will request to open the reverse tunnel which the Linux server cannot do, because there is still another session bound to that port.The computer will then wait for five minutes before trying again and try again. In the meantime the server will have release the port and the second attempt will be successfull.This all works semi-fine, but what I would like is that when a reverse-tunnel request comes in and that port is already taken that the SSH Daemon will kill the other session and accept the new tunnel. Is something like this possible?If this is possible at all, for obvious reasons the SSH daemon should only free the port if the process that is bound to it is another SSH session, but that could be fixed in other ways (like allowing the SSHD to only forward a certain port range)Any help is appreciated!P.S. dynamic port numbers is not an option.
SSH tunnels force new tunnel and kill old session
ssh;ssh tunneling;sshd