I need your advise for a very important technical issue on our project. We need to have a SSH tunnel always up between our two servers. We have a MySQL database replication process going between those two servers.

We want two things:

  • When the connection is lost it automatically reconnect without our external help
  • When the computer restart the connection go automatically online

We are running under Ubuntu.

For the moment I have to manually check if the tunnel is still active. We use SSH Tunnel Manager to start the tunnel. Previously, we were using this command : ssh root@MY_SERVER.com -L 8806:localhost:3406.

Do you know a script or a software that may help us on that case? On another Windows machine we use Bitvise that can satisfy those criteria. Normally, I found Linux easier to adapt for those kind of things, but I kind of out of options this time.


The autossh utility may do what you want

autossh is a program to start a copy of ssh and monitor it, restarting it as necessary should it die or stop passing traffic.

You should really do the job correctly and create a VPN between the two systems using openvpn (or similar).

  • I added this command in our crontab to solve the problem: @reboot autossh root@MY_SERVER.com -L 8806:localhost:3406. Thanks! – Alex J. Sep 9 '13 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.