OpenSSH ProxyCommand equivalent in PuTTY

puttyssh

I have config file which looks like that

Host <NAMEOFHOST>
   user <USERNAME>
   hostname <IP>

Host <NAMEOFHOST2>
   user <USERNAME>
   ProxyCommand ssh -q -W %h:%p <NAMEOFHOST>

and after adding this lines to config file I will be able to connect to server with command

ssh <NAMEOFHOST2>

However, there is a little problem. I don't have Ubuntu and I'd really like not to install it (because UEFI).

Thus, I'm trying to connect to server with PuTTY.

That's what I've done

Connection -> Proxy -> Proxy type = Local
                       Proxy hostname = <NAMEOFHOST>
                       Telnet command = ssh -q -W %h:%p <USERNAME>@<NAMEOFHOST>
Session -> Hostname <NAMEOFHOST2>
           Connection type = SSH

When I'm trying to connect to server I get

Server unexpectedly closed network connection

What's wrong with my settings? Thank you.


Update: Thank you for your advise with PuTTY. I tried it, however it didn't want to connect.

Thus, I tried to use OpenSSH. There I just added parameters to ssh_config. However, now, when I try to connect to server I get this

ssh_exchange_identification: Connection closed by remote host.

And I don't have any idea what I am doing wrong.

Best Answer

You probably don't have the ssh binary on your Windows system.

You can use the plink.exe with the -nc switch instead of the ssh with the -W switch:

PuTTY local proxy


An alternative is to open a tunnel via the "NAMEOFHOST" first using an another instance of PuTTY (or Plink).

See for example, my guide for tunneling SFTP/SCP session. It's for WinSCP, but just use PuTTY instead of WinSCP in section Connecting through the tunnel.


Alternatively, you can get ssh.exe from Microsoft build of OpenSSH for Windows. On Windows 10 version 1803 or newer, OpenSSH is built-in. On older versions of Windows 10, you can install it or you can just download a ZIP package. The client tools do not need any installation, you can just extract them.

See also Does OpenSSH support multihop login?

Related Question