【问题标题】:visual studio code remote ssh over ssh proxyVisual Studio 代码远程 ssh 通过 ssh 代理
【发布时间】:2020-01-04 15:15:03
【问题描述】:

我正在尝试使用 vs-code 的 remote-ssh extension 通过 ssh 隧道连接到服务器。 服务器是没有公共 IP 地址的内部集群的一部分,我使用link 中概述的方法通过集群中的代理连接到它:

# ~/.ssh/config
Host internal*
User root
ProxyCommand ssh user@firewall 'nc %h %p'

当我尝试连接到内部服务器时,我收到以下错误对话框:

无法建立与“内部服务器”的连接。该进程试图写入一个不存在的管道。

输出窗口的日志:

remote-ssh@0.45.6
win32 x64
SSH Resolver called for "ssh-remote+internal-server", attempt 1
SSH Resolver called for host: internal-server
Setting up SSH remote "internal-server"
Using commit id "........" and quality "stable" for server
Testing ssh with ssh -V
ssh exited with code: 0
Got stderr from ssh: OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
Running script with connection command: ssh -o ClearAllForwardings=true internal-server bash
Install and start server if needed
> 
Got some output, clearing connection timeout
> ]0;C:\WINDOWS\SYSTEM32\cmd.exe
> 
> CreateProcessW failed error:2
> 
> posix_spawn: No such file or directory
> The process tried to write to a nonexistent pipe.
> 
"install" terminal command done
Install terminal quit with output: The process tried to write to a nonexistent pipe.
Received install output: The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe
TELEMETRY: {"eventName":"resolver","properties":{"outcome":"failure","reason":"OfflineError"},"measures":{"resolveAttempts":1,"retries":1}}
------

如何使用 vs-code 的 remote-ssh 连接到代理/防火墙后面的计算机?

【问题讨论】:

    标签: ssh visual-studio-code remote-debugging


    【解决方案1】:

    对于遇到相同问题的人,我通过给出 ssh 的绝对位置来解决它,例如:

    ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p server
    

    【讨论】:

    • 这应该是公认的答案!感谢您的帮助,这解决了我的问题!出于某种原因,Windows 需要知道我的 ProxyCommand 在哪里 X_x。
    • 我在哪里添加它?在远程 ssh 配置中?
    【解决方案2】:

    到目前为止,我已经探索了两个原因。

    1. 由于 ssh 文件的配置错误/冲突,您正面临此错误。对我有用的是,我有目录“C:\Users\gur51262”,它有 ssh 配置,但还有另一个目录在路径“C:\ProgramData\ssh”上也有文件“ssh_config”,这可能是与它产生冲突。

    所以我只配置了此路径“C:\Users\gur51262”上存在的文件,而我省略了路径“C:\ProgramData\ssh”上存在的其他文件的内容。

    还要确保您遵循配置文件的语法(如果有)。喜欢

    Host host203
      HostName 172.19.51.203
      User root 
    

    解决方案适用于 windows7。

    1. “.ssh/config”文件中存在冲突的可能性。可能存在重复的 hostname 条目,如下所示

      Host 172.19.51.212
        HostName 172.19.51.212
      Host 172.19.51.212
        HostName 172.19.51.212
        User root
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-10
      • 2019-04-13
      相关资源
      最近更新 更多