Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically start a tunnel when a session is opened in MobaXterm?

I use MobaXterm for remote access to servers running in the cloud. For development and admin purposes, these servers expose admin application on local network interfaces. For example, Tomcat will expose 127.0.0.1/manager.

Since I prefer not to have to expose these services to the internet, I've set up ssh tunnels in MobaXterm to connect to these web applications on a local port through local port forwarding, which is easy to set up with the application itself.

My question: How can you get MobaXterm to automatically start a tunnel when a session is opened and to stop/close them when the session is ended?

I know a client like Putty would do this by default, but I don't want to use different clients for different jobs if I don't have to and MobaXterm has other features I need that Putty doesn't.

like image 349
Grismar Avatar asked May 23 '18 04:05

Grismar


People also ask

How do you keep tunnels open?

Keeping Tunnel Open-M Specify the port to monitor, 0 disable port monitoring and will restart only on ssh exit. -f is sends autossh to the background before running SSH. ServerAliveInternal is the key here as it will send keep-alive packet every given seconds to avoid SSH session to time-out.

How do I start an SSH tunnel?

Set up SSH Tunneling in WindowsLaunch Putty and enter the SSH server IP Address in the Host name (or IP address) field. Under the Connection menu, expand SSH and select Tunnels . Check the Local radio button to setup local, Remote for remote, and Dynamic for dynamic port forwarding.


1 Answers

You can setup new SSH tunnels in Tunneling section (or from the MobaXterm's Tools menu, you can start MobaSSHTunnel). This will show a graphical port forwarding tool, where you can setup a new SSH tunnels which can be configured to be started automatically at MobaXterm startup by selecting Autostart from the tunnel settings.

MobaXterm's MobaSSHTunnel, SSH tunnel, dynamic local remote port forwarding

like image 118
kenorb Avatar answered Sep 19 '22 03:09

kenorb