Tested on CentOS, but should be applicable on Ubuntu as well.
- Add Epel repo, https://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
- Install autossh
$ yum install autossh
- Run autossh command with the following format
$ autossh -M -fN <login@remoteserver> -R :localhost:22 E.g.: $ autossh -M 20000 -fN support@remote.com -R 12021:localhost:22