Search code examples
javapythonsshpycharmremote-debugging

PyCharm can't connect to a remote behind a gateway (java.net.UnknownHostException)


I try to connect to a remote machine that is behind a gateway for debug and deploy.

By setting ~/.ssh/config to

Host target_machine_name
    ProxyCommand ssh gateway_machine -W %h:%p

I can ssh from the command line to that machine (with: ssh target_machine_name)

However, when I try to "configure remote python interpreter", I end up with the following error:

java.net.UnknownHostException: target_machine_name

Any idea how to forward the communication in a manner that be supported by java.net?


Solution

  • I managed to solved the issue, by replacing the tunneling, with an explicit ssh tunneling command, as in this answer

    ssh -N -L localhost:2260:target_machine_name:22 gateway_machine
    

    and directing ssh to localhost with port 2260