2

At my work, we have a jump host over which I must connect to the cluster. Usually, the connection statement would be

ssh -t herp@jumphost ssh cluster

Furthermore, this connection has to be made from within the companies VPN. Now, I want to connect to cluster using VS Code on Windows 10. This creates several problems. This blog post suggests to use the ssh config file for this so I added the following lines to C:\Users\Herp\.ssh\config:

Host jumphost
   HostName jumphost
   User herp

Host cluster-work User herp HostName cluster ProxyCommand ssh -tt jumphost

Then, when I try to connect using cmd.exe or the PowerShell I get:

$ ssh cluster -v
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data C:\\Users\\Herp/.ssh/config
debug1: C:\\Users\\Herp/.ssh/config line 18: Applying options for cluster-work
debug1: Executing proxy command: exec ssh -tt jumphost
debug1: identity file [...]
[...]
debug1: identity file [...]
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
herp@jumphost's password: <I enter the PW>
debug1: kex_exchange_identification: banner line 0: Last login: Mon Jun 28 20:50:42 2021 from <some IP>
debug1: kex_exchange_identification: banner line 1:
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_8.1
debug1: match: OpenSSH_for_Windows_8.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to cluster:22 as 'herp'
debug1: SSH2_MSG_KEXINIT sent
Bad packet length 218783296.
ssh_dispatch_run_fatal: Connection to UNKNOWN port 65535: message authentication code incorrect

Sometimes, the last few lines are instead

debug1: kex_exchange_identification: banner line 0: Last login: Mon Jun 28 20:50:42 2021 from <some IP>
debug1: kex_exchange_identification: banner line 1:
debug1: kex_exchange_identification: banner line 2: \033]0;herp@cluster:~\033[?1034h[herp@cluster ~]$ SSH-2.0-OpenSSH_for_Windows_8.1
debug1: kex_exchange_identification: banner line 3: -bash: SSH-2.0-OpenSSH_for_Windows_8.1: command not found
debug1: kex_exchange_identification: banner line 4: \033]0;herp@cluster:~[herp@cluster ~]$

If I use -t instead of -tt in the ProxyCommand, the last few lines before and after I enter the password are

Pseudo-terminal will not be allocated because stdin is not a terminal.
herp@jumphost's password: <I enter the PW>
-bash: line 1: $'SSH-2.0-OpenSSH_for_Windows_8.1\r': command not found

and then cmd.exe freezes so that I have to close the window.

How can I get this connection to work?

Update

Using the -J flag instead of -t leads to:

> ssh -J herp@jumphost herp@cluster
herp@jumphost's password: <I enter the PW>
channel 0: open failed: administratively prohibited: open failed
stdio forwarding failed

Update 2

I repeated this in WSL with the same result. So this is not only a Windows 10 problem.

1 Answers1

1

To set up ssh -t herp@jumphost ssh cluster in the SSH config file you need RequestTTY force and RemoteCommand:

Host ⟨your label⟩
    HostName jumphost
    User herp
    RequestTTY force
    RemoteCommand ssh cluster

At least it worked for me on Linux. Kamil Maciorowski posted an explanation here.