- Install Cygwin64 for Windows: https://www.cygwin.com/ (alternatively, you could possibly use the Linux Subsystem for Windows now for Win 10+, but I've not tried this).
- Enable
AutoSSH
module in Cygwin: https://support.chartio.com/docs/data-sources/autossh-windows. - Copy the
.ssh/
folder to your Windows user directory (e.g.C:\Users\<USERNAME>\.ssh
) - Create your SSH public/private key pair (https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ssh-from-windows). Ensure the private key is saved as
C:\Users\<USERNAME>\.ssh\id_rsa
, and the public key is saved as:C:\Users\<USERNAME>\.ssh\id_rsa.pub
. - Modify the SSH config file using the example
C:\Users\<USERNAME>\.ssh\config
, to setup your port forwarding tunnels and hosts. - Copy your public SSH key to the server you wish to connect to via SSH. The private key remains on your local computer only.
- Install the Non-Sucking Service Manager (NSSM) for Windows: https://nssm.cc/download to the following location:
C:\Program Files\nssm-2.24\win64\nssm.exe
. - Copy the
Autossh
folder toC:\Users\<USERNAME>\Autossh
. - Run the
C:\Users\<USERNAME>\Autossh\nssm-install-autossh.bat
file as an Administrator. When prompted to choose the executable, selectC:\Users\<USERNAME>\Autossh\run-autossh.bat
. Also, enter a name for the new service. - You should now find the service in the
services.msc
dialog. Change the startup type toAutomatic (delayed)
and test!
cgddrd/autossh-tunnel-windows
A quick repo documenting my configuration for setting up AutoSSH on Windows for tunnelling.
Batchfile