问题
I am trying to use vs-code's remote-ssh extension to connect to a server over a ssh tunnel. The server is part of an internal cluster that does not have a public ip address, and I connect to it via a proxy in the cluster using the method outlined in link:
# ~/.ssh/config
Host internal*
User root
ProxyCommand ssh user@firewall 'nc %h %p'
When I try to connect to the internal server, I get the following error dialog:
Could not establish connection to "internal-server". The process tried to write to a nonexistent pipe.
The output window's log:
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}}
------
How can I use vs-code's remote-ssh to connect to computers behind a proxy/firewall?
回答1:
For anyone running into the same problem, I solved it by giving the absolute location of ssh, eg:
ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p server
回答2:
There can be two reasons till now which I've explored.
- You are facing this error because of misconfiguration/conflict in/of your ssh file. What worked for me is , I am having directory "C:\Users\gur51262" which is having ssh configuration but there is another directory also which is having file "ssh_config" on path "C:\ProgramData\ssh" which is may be creating conflict with it .
So I have only configured file which is present on this path "C:\Users\gur51262" and I've omitted the content of other file which is present on path "C:\ProgramData\ssh".
Also make sure you are following syntax of config file , if there is any. Like
Host host203
HostName 172.19.51.203
User root
Solution is for windows7.
There are chances of conflicts in ".ssh/config" file. There may be a duplicate entry of hostname , like below
Host 172.19.51.212 HostName 172.19.51.212 Host 172.19.51.212 HostName 172.19.51.212 User root
来源:https://stackoverflow.com/questions/57742450/visual-studio-code-remote-ssh-over-ssh-proxy