VScode remote connection error: The process tried to write to a nonexistent pipe
Solution 1
Add the absolute file path to a custom SSH config file(C:\Users\{USERNAME}\.ssh\config), and my problem is solved.
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:
- delete ssh config folder both in
C:\Program Data\ssh
andC:\<user>\.ssh
- In VS Code, press
F1
, chooseRemote-SSH: Connect to Host...
- Do NOT enter anything in the prompt, but instead choose
+ Add New SSH Host..
- 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.) - You will be asked to choose a folder in which a new config file will be created. Choose any of the two options.
- 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.
Solution 5
At least three things may be happening:
Option 1
The location of your config file is not the absolute location, meaning you are probably using the location of the folder where the config file is.
If that is the case, access your User Settings in VSCode. Scroll to the Extensions
>Remote - SSH
. And add config
at the end of the absolute file path of your custom SSH config file. In Windows, it can be
C:\Users\user\.ssh\config
See image below
Option 2
Authentication problems.
If that is the case, one of the things that may solve is generating new SSH keys.
In Windows, for that, I recommend using MobaXterm.
In MobaXterm, open a new terminal and write
ssh-keygen -b 4096 -t rsa
Then, in the config file, make sure that the IdentityFile
points to the location of the key. MobaXterm's home directory, usually, is C:\Users\user\Documents\MobaXterm
. If it makes it easy, one can copy/move the keys to C:\Users\user\.ssh
and then just add, in the config file, IdentityFile ~/.ssh/KEY_rsa
(where KEY_rsa
is the name of the [public] key).
Note that if you use PuTTY to generate the keys, on the server OpenSSH authorized_keys file, one doesn't want the public key that one saves, but the one that appears on top (see image bellow):
Option 3
Your config
file may be wrong.
The config file tends to look as follows. Double check if the fields have the information needed for the connection to be established.
Host Test # This is the name we want to give the host
User user # This is the username
Hostname blabla.com # This is the hostname
PreferredAuthentications publickey
IdentityFile ~/.ssh/KEY_rsa # This is the location of the key
IdentitiesOnly yes
Port 50 # This varies
douyu
Updated on July 05, 2022Comments
-
douyu almost 2 years
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] ------
-
bones.felipe almost 4 yearsIn addition to this I had to add the new host and then connect to it. Just connecting to the host didn't work.
-
yishairasowsky almost 4 yearshow did you get to that screen of "remote ssh etc" shown in your answer?
-
douyu almost 4 years@yishairasowsky
crtl+shift+p
and enter remote-ssh: settings. -
Karan Singh over 3 yearsThank You! It was initially empty for me.
-
user3507825 over 3 yearsThis actually broke things further when I tried it. Now it does not even get to the part making the OP's errors. I get the following error in VSC: Command 'Remote-SSH: Connect to Host...' resulted in an error (EISDIR: illegal operation on a directory, read) - I checked permissions and I have full control. When I revert, the OP error returns.
-
TecHunter over 3 yearstry to delete the known_hosts file too. Or edit to remove the server fingerprint
-
TecHunter over 3 yearscheck also the id_rsa or id_ed21559 file. mine was badly exported by puttygen
-
aviator over 3 yearsWhy exactly would this help? It didn't fix anything for me.
-
aviator over 3 yearsOk, resolved now. For future visitors, there may be multiple reasons -- mine was that I was trying to point the SSH config "IdentityFile" flag (i.e. private key) to a PuTTY file (.ppk extension), whereas it should be an OpenSSH file (typically no extension) instead.
-
Pramus about 3 yearsAlso check the syntax of your config file - in my case there was auto-generated
usekeychain
that is used my macOS and wasn't recognized by my Windows host. VSCode won't tell you about that but if you try to ssh using PowerShell, you'll get the error message. -
NdFeB about 3 yearsDeleting a whole config directory or file is very representative of a "i don't know what i'm doing" behavior. You just had to delete the conflicting line from
known_hosts
, and of course before that, double check that your remote host was not getting impersonated. -
NdFeB about 3 yearsDeleting a whole config directory or file is very representative of a "i don't know what i'm doing" behavior. You just had to delete the conflicting line from
known_hosts
, and of course before that, double check that your remote host was not getting impersonated. -
Indrajeet Gour about 3 yearsI added escape char but nth worked out and what about ``` after username you used?
-
rioV8 about 3 yearseven connecting to a local Virtual Machine and no internet connection gives this error
-
Mycodingproject almost 3 yearsThis is the only solution that has worked for me. Thanks. In addition to this, I also deleted
known_hosts
,config
files in local computer and on server the.vscode-server
directory. -
bluiska almost 3 yearsThis is what you need to do!
-
Dawoodjee almost 3 yearsThanks. VS Code, this should work by default. I wonder why we have to jump through hoops
-
Dami almost 3 yearsIt works! Created a config file. Added path in settings as described. Ctrl+P (Windows) command pallet & typed
>Remote SSH: Connect to host...
Selected +Add New SSH Host. Entered the full SSH command. Added to the config file. And VSCode connected asked for the pw. -
angryweasel almost 3 yearsThis should be the accepted answer. Thank you!
-
xmnboy over 2 yearsI ran into a problem like that described by this answer. My issue was caused by using the ssh
ProxyJump
feature in my config file to connect to some of my remote systems. It turns out that the Microsoft version ofOpenSSH
does not support theProxyJump
feature (Sep 2021), but theGit for Windows
implementation ofOpenSSH
does support theProxyJump
feature. So pointing to the Git for Windows version fixed things for me, as well. I think a recent update of Git for Windows on my system caused the order of those two instances ofssh.exe
to be reversed in the PATH. -
parttimeturtle over 2 yearsThis was it... crazy that the error message doesn't give you any hint about it.
-
zenzone over 2 yearsStep 4 for worked for me (superuser.com/questions/1296024/…). Bizarre because it was working perfectly fine for ages. Then suddenly started kicking off about permissions being too open!
-
Mark Rajcok over 2 yearsI had the exact same problem, and ended up with the same solution by trying all sorts of different settings changes. Thanks for the confirmation that this is the working solution. I wish I read this about 45 min ago.
-
jemand771 over 2 yearsas a note on how this could happen: the GitPod local companion extension changed the config path from the correct setting to some temporary file and didn't revert it back. That's why my hosts couldn't be found anymore
-
geekygeek over 2 yearsReinstalled my server and was having OP's error message. This has fixed the problem.
-
Amar Kumar over 2 yearsYes, Removing that old SSH entry from that Known_host file is important here. For me too it worked after removing old fingerprint entry from known_host file.
-
Dirk Schiller over 2 yearsAmazing!!! Tried all the above but this one solved it! Hero you are!
-
Tom Stambaugh over 2 yearsIn the "PROBLEMS" pane of VSC, it showed what was causing the failure. In my case, I'm connecting to a guestVM (running locally) and its hostkey changed. The complaint told me the line number (19) that was failing in hostkeys. The solution was easy -- I used an editor (notepad++) to remove the offending line. I then invoked "Remote SSH: Connect to host"), selected the host, and accepted the new hostkey it offered. This solved my problem and left all my other connections unbroken.
-
Tom Stambaugh over 2 yearsThis destroys ALL the connections! There is an easier way. In my case, the issue was caused by a hostkey that changed. The "PROBLEMS" pane reported the failing entry in hostkeys (line 19). I used notepad++ to remove that line. I then invoked "Remote SSH: Connect to host" and selected the failing host. This time, it prompted me for a hostkey and invited me to accept it. Once I accepted the hostkey, all was fine.
-
Tom Stambaugh over 2 years@angryweasel: I don't think this should be the accepted answer, because it destroys all the existing connections. For those of us with many (at least six in my case), that's a serious flaw.
-
Eta over 2 years@NdFeB When there is 10 differents anwsers and none of them work, i'm pretty sure nobody knows what they are doing. My solution was.. to restart my computer -__-'
-
Arun Jayaramakrishnan over 2 years@drik-schiller Thanks 😁 I don't know where I saw this answer myself 🤣🤣
-
ADJenks over 2 yearsI don't understand why this worked. After setting the config file path, I added a host, and it added another entry to the same config file. It was already using that config file. It seems like nothing changed. I actually made a typo in the new host and then deleted the one I just added and used the old config. Literally nothing changed except that I told it to use the path that it was already using. This is voodoo.