How to create SSH tunnel using PuTTY in Windows?

前端 未结 5 1585
长发绾君心
长发绾君心 2020-11-29 01:40

I need to create SSH tunnel with PuTTY in Windows, that would do the same as this command in Linux:

ssh -fN -L 2000:SomeIp:2000 myusername@myLinuxBox
         


        
5条回答
  •  有刺的猬
    2020-11-29 01:55

    The answers above mention two different ways of resolving the problem:

    • using plink
    • using putty GUI

    I don't have plink and I can't download the plink.exe file (it is a closely monitored restricted environment) so used a different way to script the solution with a one-line script:

    start putty -ssh myusername@myLinuxBox -pw my_pw -L 2000:localhost:2000
    

    Store this in a batch file (file extension ".bat", e.g. "tunnel.bat"). So every time you double-click on this file the command is run and putty creates the ssh tunnel. If you want more tunnels just repeat this part

    -L 2000:localhost:2000

    by changing the ports accordingly.

提交回复
热议问题