2

I am trying to SSH to a server via an intermediately jump host on Windows Git Bash but I get the following error.

/usr/bin/bash: line 0: exec: nc: not found

$ ssh -vnNT -L 2555:destination-server.com [email protected] -o "ProxyCommand=nc -X 5 -x proxy.abc.com:4850 %h %p"

OpenSSH_8.8p1, OpenSSL 1.1.1l  24 Aug 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec nc -X 5 -x proxy.abc.com:4850 x.amazonaws.com 22
debug1: Local version string SSH-2.0-OpenSSH_8.8
/usr/bin/bash: line 0: exec: nc: not found *********************************** => ERROR LINE
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

How can I resolve this error?

1 Answer 1

9

The reason is that Git Bash for Windows has no nc (netcat) command.

As a workaround please replace:

nc -X 5 -x proxy.abc.com:4850 %h %p

with

connect -S proxy.abc.com:4850 %h %p

So the final command would be:

ssh -vnNT -L 2555:destination-server.com [email protected] -o "ProxyCommand=connect -S proxy.abc.com:4850 %h %p"

Even if you're using nc from an ssh config file, you can replace nc -X 5 -x with connect -S, and it should work.

Example:

Replace

Replace

with

working command

Sign up to request clarification or add additional context in comments.

1 Comment

Hi, where can I find the connect command? It looks like when I type the whereis connect under the git for windows bash shell, it returns nothing. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.