

That's why I come up with custom Powershell script, easy configurable, changeable, small, but works. I tried many solutions like SSH tunnel managers, but all were inconvinient for me: too many configuration screens, sometimes buggy (one time SSH tunnel manager purged all! settings I had! So I had to restore settings for all 30 tunnels).
#SSH TUNNEL MANAGER TEXT CUT OFF HOW TO#
I did find this question: How to reliably keep an SSH tunnel open?, but that's using Linux as the SSH client, and I'm using Windows. I'm planning on making a dedicated user with no privileges and not allowed to interactively log in, and use that.)

(Yes, I am aware of the hazards of automatically logging in to SSH. The two tunnels are one local tunnel, and one remote tunnel. The data I'm sending across the two tunnels is VNC connections, so I often won't be at the machine to clear errors and enter passwords. What I'd like to do is have an application that can set up the two SSH tunnels, and can automatically reconnect, without needing to manually do anything, including enter a password. This works well, except when the SSH connection drops: PuTTY displays an error message, and I need to manually close the error and reconnect to the server.
#SSH TUNNEL MANAGER TEXT CUT OFF WINDOWS#
If your original template matches your tunneling purpose, then you can just copy the tunnel configuration file and do the changes you want to create the new tunnel, then you can start and enable the tunnel from systemctl.I'm trying to set up a Windows computer to always have two SSH tunnels to my Linux server.Ĭurrently, I'm using PuTTY to open the two SSH tunnels: I log in to the server in PuTTY, leave it minimized, and never touch it. # systemctl enable How to create a new tunnel

REMOTE_HOST ← The remote host end of the tunnel.LOCAL_PORT ← The local port of the local ip.LOCAL_ADDR ← The local ip to bind the tunnel.This configuration requires ssh keys in order to communicate with the SSH GatewayĬreate the following template Description=Setup a secure tunnel to %I After=network.target Environment="LOCAL_ADDR=localhost" ExecStart=/usr/bin/ssh -NT -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -L $ ← The SSH gateway between the local machine and the remote serverĬreate the following file will hold the actual tunnel configuration options, here is an example fileĬontent: TARGET=gateway1 TUSER=root LOCAL_ADDR=127.0.0.1 LOCAL_PORT=49998 REMOTE_PORT=443 REMOTE_HOST=10.1.1.1 The file with the SSH tunnel connections must be in this form, is actually the ssh part without the ssh command, each line must is a separate tunnel. Much often you will need a constant SSH tunnel connection, to avoid the administrative load for those tunnels after a reboot is to configure them as systemd services and use SSH keys to avoid passwords.Īlso its nice and super helpfull to create the systemd service as a template that can accept tunnel parameters from a file, this allow very easily to manage your tunnels (add,delete,modify,start,stop). Linux: How to create an SSH tunnel as a systemd service
