Visual Studio代码通过ssh代理远程ssh

2023-12-22

我正在尝试使用 vs-code远程 ssh 扩展 https://code.visualstudio.com/docs/remote/ssh通过 ssh 隧道连接到服务器。 该服务器是内部集群的一部分,没有公共 IP 地址,我使用集群中概述的方法通过代理连接到它link https://backreference.org/2010/02/26/jump-in-with-ssh-and-netcat/:

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

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

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

输出窗口的日志:

[email protected] /cdn-cgi/l/email-protection
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 的远程 ssh 连接到代理/防火墙后面的计算机?


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

ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p server
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Visual Studio代码通过ssh代理远程ssh 的相关文章

随机推荐