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 me@servername.cz
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[19725]: Accepted publickey for me from 90.179.155.74 port 37416 ssh2
Oct 29 03:11:15 vm sshd[19727]: Received disconnect from 90.179.155.74: 11: disconnected by user
Oct 29 03:17:04 vm sshd[20892]: Accepted publickey for me from 90.179.155.74 port 40116 ssh2
Oct 29 03:17:15 vm sshd[20896]: error: bind: Address already in use
Oct 29 03:17:19 vm sshd[20896]: error: channel_setup_fwd_listener: cannot listen to port: 20000
And this goes on. Any idea what can be wrong?