RHEL9: ssh'ing through a proxy fails with "kex_exchange_identification: Connection closed by remote host"

Solution Verified - Updated -

Issue

  • When configuring ssh with a proxy (HTTP, SOCKS, ...), the ssh session fails immediately before authentication, as shown in the example below

    $ ssh -o ProxyCommand="nc --proxy <proxy:8080> --proxy-type http %h %p" <user>@<remote-system> true
    kex_exchange_identification: Connection closed by remote host
    Connection closed by UNKNOWN port 65535
    

Environment

  • Red Hat Enterprise Linux 9
    • nmap-ncat

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content