I have setup ssh tunnel to be able to connect a target computer behind NAT. I have put the following into /etc/inittab on the computer:
tu:2345:respawn:/usr/bin/autossh -M 20000 -f -n -N -T -R 6790:localhost:22 email@example.com
It works, ie i can connect by issuing ssh -p 6790 me@localhost. But every now and then i get the following message on the target computer:
INIT: Id "tu" respawning too fast, disabled for 5 minutes
In /var/log/secure on the server, I can see the following:
Oct 29 03:11:15 vm sshd: Accepted publickey for me from 184.108.40.206 port 37416 ssh2 Oct 29 03:11:15 vm sshd: Received disconnect from 220.127.116.11: 11: disconnected by user Oct 29 03:17:04 vm sshd: Accepted publickey for me from 18.104.22.168 port 40116 ssh2 Oct 29 03:17:15 vm sshd: error: bind: Address already in use Oct 29 03:17:19 vm sshd: error: channel_setup_fwd_listener: cannot listen to port: 20000
And this goes on. Any idea what can be wrong?