Tunnel using PuTTY - equivalent for ssh command?

7

2

I am trying to connect to a remote server, based on the instructions given on this page:
https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#ssh-tunnels

It suggests to create a tunnel from my local machine to my server using the command:

ssh -NfL localhost:5006:localhost:5006 user@remote.host

However my local machine is Windows - being a beginner programmer I have trouble figuring out how to reproduce the above mention command, but with PuTTY.

Could anyone help me out with that?

Thanks

jim basquiat

Posted 2017-10-29T20:49:35.190

Reputation: 217

Answers

4

You can do this directly with Putty command line:

putty.exe -L 5006:<remote_host>:5006 -P 22 -l <user> -pw <pwd>

where

  • <remote_host> is your remote host (running the server listening on port 5006)
  • <user>/<pwd> are the credentials to access via SSH to <remote_host>

assuming SSH port is 22

beaver

Posted 2017-10-29T20:49:35.190

Reputation: 141

2

PuTTY comes with console client Plink.

Plink has the same command-line syntax as OpenSSH ssh except:

  • for the -f switch, which does not have an equivalent in Windows.
  • and you cannot combine multiple switches after one dash - so instead of -NL ..., you have to use -N -L ....

So, you can use:

plink.exe -N -L localhost:5006:localhost:5006 user@remote.host

Reference: Using the command-line connection tool Plink


Alternatively you can setup the tunnel in PuTTY GUI.

See How to create SSH tunnel using PuTTY in Windows?

Martin Prikryl

Posted 2017-10-29T20:49:35.190

Reputation: 13 764

I add to use -L instead of -NL which was unrecognized. – Alfred M. – 2018-03-26T15:49:28.870

@AlfredM. True, I've updated my answer. – Martin Prikryl – 2018-03-26T16:01:05.803