Always up SSH SOCKS Proxy on Windows

For additional security, I use SSH tunneling to one of my servers and dynamic port forwarding for some of my applications. This post explains how to use Putty to have a tunnel/SOCKS proxy that is created automatically on startup, and reconnects when disconnected, without any annoying windows open.

batch file for tunnel creation

Create a tunnel.bat and put it somewhere, eg. in your program folder. Download plink from the Putty website.
@echo off
:repeat
d:\path\to\plink.exe -N -P 22 -D 1080 youruser@example.com -pw yourpassword -i d:\path\to\your\keyfile.ppk
goto repeat

-P 22 = connect to port 22
-D 1080 = create a dynamic tunnel (socks proxy) on localhost:1080

hide batch window

Download hstart ([url=http://www.ntwind.com/software/utilities/hstart.html]homepage[/url])

autostart

create a link inside your autostart folder.
d:\path\to\hstart.exe /NOCONSOLE /D="d:\path\to\batchfile" "d:\path\to\batchfile\tunnel.bat"
Done! Enjoy your tunnel.

Leave a Reply

Your email address will not be published. Required fields are marked *