VScode remote connection error: The process tried to write to a nonexistent pipe

I use vscode with remote-ssh to connect my server, after configuring, I want to connect my host, but it failed, the dialog box display:"could not establish connection to XX, The process tried to write to a nonexistent pipe."

output:

[16:45:20.916] Log Level: 3
[16:45:20.936] [email protected]
[16:45:20.936] win32 x64
[16:45:20.944] SSH Resolver called for "ssh-remote+aliyun", attempt 1
[16:45:20.945] SSH Resolver called for host: aliyun
[16:45:20.945] Setting up SSH remote "aliyun"
[16:45:21.012] Using commit id "c47d83b293181d9be64f27ff093689e8e7aed054" and quality "stable" for server
[16:45:21.014] Install and start server if needed
[16:45:21.019] Checking ssh with "ssh -V"
[16:45:21.144] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[16:45:21.214] Running script with connection command: ssh -T -D 5023 aliyun bash
[16:45:21.221] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[16:45:21.504] > 
> 
>
> ]0;C:\WINDOWS\System32\cmd.exe
[16:45:21.505] Got some output, clearing connection timeout
[16:45:21.577] > 
> 
>
> 
[16:45:21.592] > Bad owner or permissions on C:\\Users\\DY/.ssh/config
> 
[16:45:21.689] > The process tried to write to a nonexistent pipe.
> 
[16:45:22.091] "install" terminal command done
[16:45:22.092] Install terminal quit with output: The process tried to write to a nonexistent pipe.
[16:45:22.093] Received install output: The process tried to write to a nonexistent pipe.
[16:45:22.096] Resolver error: The process tried to write to a nonexistent pipe
[16:45:22.107] ------


Solution 1:

Add the absolute file path to a custom SSH config file(C:\Users\{USERNAME}\.ssh\config), and my problem is solved.

enter image description here

Solution 2:

If you format/re-install Server OS, but use same IP as before, you may encounter fingerprint mismatched.

You may need to delete old fingerprint in this file: C:\Users\xxx.ssh\known_host

and old IP in the file: C:\Users\xxx.ssh\config

Then try to add host again.

Solution 3:

What worked for me:

  1. delete ssh config folder both in C:\Program Data\ssh and C:\<user>\.ssh
  2. In VS Code, press F1, choose Remote-SSH: Connect to Host...
  3. Do NOT enter anything in the prompt, but instead choose + Add New SSH Host..
  4. Enter the full ssh command, including the key (in case of Windows, you may want to enclose the path with double quote mark) ssh -i "C:\path\to\key" user@host. (you need to make sure the key has a limited permission. Remove all inherited permissions, and only give a full control to the owner.)
  5. You will be asked to choose a folder in which a new config file will be created. Choose any of the two options.
  6. There will a prompt notifying that the new config file has been created. Click connect

Solution 4:

What worked for me was to delete all of the contents of folder: C:\Users\MYNAME.ssh That meant to delete both the config file and known-hosts. The config was probably the most important one to delete.