Set up an SSH tunnel as a Windows service using putty (plink) 

Joined:
04/09/2007
Posts:
710

December 12, 2007 22:57:22    Last update: March 25, 2011 15:05:40
1. Install windows resource kit.

2. Install srvany as a service:
C:\tools\putty>instsrv ssh_tunnel "C:\Program Files\Windows Resource
 Kits\Tools\srvany.exe"


3. Edit the following registry template to suite your environment:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ssh_tunnel\Parameters]
"Application"="C:\\tools\\putty\\plink.exe"
"AppDirectory"="C:\\tools\\putty"
"AppParameters"="-ssh -2 -L bind_host:22:forward_host:22 -l userid -pw passwd 192.168.21.1 -N"


4. Import the registry entry.

5. Start the service with "net start ssh_tunnel" or from the services applet.

You may choose to use a batch file for srvany (instead of plink.exe), but you won't be able to shut down the tunnel when you stop the service.

Also, if the Windows SYSTEM user cannot see the host key for SSH connection, the tunnel cannot be established.
Share |
| Comment  | Tags
 
Easy email testing with http://www.ximailstop.com