【问题标题】:PyCharm can't connect to a remote behind a gateway (java.net.UnknownHostException)PyCharm 无法连接到网关后面的远程 (java.net.UnknownHostException)
【发布时间】:2017-07-25 12:11:50
【问题描述】:

我尝试连接到网关后面的远程计算机进行调试和部署。

通过将~/.ssh/config 设置为

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

我可以从命令行 ssh 到那台机器(使用:ssh target_machine_name

但是,当我尝试“配置远程 python 解释器”时,我最终得到以下错误:

java.net.UnknownHostException: target_machine_name

知道如何以 java.net 支持的方式转发通信吗?

【问题讨论】:

    标签: java python ssh pycharm remote-debugging


    【解决方案1】:

    我设法解决了这个问题,通过使用明确的 ssh 隧道命令替换隧道,如 this answer

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

    并使用端口 2260 将 ssh 定向到 localhost

    【讨论】:

    • 您是否将此行添加到.ssh/config 文件中? as ``` Host target_machine_name ProxyCommand ssh -N -L localhost:2260:target_machine_name:22 gateway_machine```
    猜你喜欢
    • 2014-03-25
    • 1970-01-01
    • 2015-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-02
    • 1970-01-01
    • 2020-10-31
    相关资源
    最近更新 更多