简体   繁体   中英

Connecting to remote linux server with VSCode through WSL - File location issue?

When attempting to use VS Code / WSL to remote into a linux server hosted as a Digital Ocean droplet, we're getting this error:

[17:38:24.258] Log Level: 2
[17:38:24.260] remote-ssh@0.63.0
[17:38:24.260] win32 x64
[17:38:24.262] SSH Resolver called for "ssh-remote+100.100.10.100", attempt 1
[17:38:24.263] "remote.SSH.useLocalServer": false
[17:38:24.263] "remote.SSH.showLoginTerminal": false
[17:38:24.263] "remote.SSH.remotePlatform": {"$remote_server_name":"linux"}
[17:38:24.264] "remote.SSH.sshPath": undefined
[17:38:24.264] "remote.SSH.sshConfigurationFile": undefined
[17:38:24.264] "remote.SSH.useFlock": true
[17:38:24.265] "remote.SSH.lockfilesInTmp": false
[17:38:24.265] "remote.SSH.localServerDownload": auto
[17:38:24.265] "remote.SSH.remoteServerListenOnSocket": false
[17:38:24.265] "remote.SSH.showLoginTerminal": false
[17:38:24.266] SSH Resolver called for host: 100.100.10.100
[17:38:24.266] Setting up SSH remote "100.100.10.100"
[17:38:24.278] Using commit id "ea3859d4ba2f3e577a159bc91e3074c5d8c0523" and quality "stable" for server
[17:38:24.285] Install and start server if needed
[17:38:25.556] Checking ssh with "ssh -V"
[17:38:25.713] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

[17:38:25.726] Running script with connection command: ssh -T -D 53538 "100.100.10.100" bash
[17:38:25.735] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[17:38:26.931] > no such identity: /home/user/.ssh/id_rsa: No such file or directory
> ]0;C:\WINDOWS\System32\cmd.exe
[17:38:26.933] Got some output, clearing connection timeout
[17:38:26.940] > root@100.100.10.100: Permission denied (publickey).
> The process tried to write to a nonexistent pipe.

As far as I can see, the issue lies with

[17:38:26.931] > no such identity: /home/user/.ssh/id_rsa: No such file or directory

However

ssh -vv root@100.100.10.100 -i /home/user/.ssh/id_rsa

Successfully connects in the debug and server is accessed

debug1: Authentication succeeded (publickey).

So this must be some issue with specifying the location of id_rsa in the config file for VS Code.

Host 100.100.10.100
  HostName 100.100.10.100
  User root
  ForwardAgent yes
  IdentityFile /home/autosermo/.ssh/id_rsa

We have tried everything we can think of for the value of IdentityFile (... ~/.ssh/id_rsa etc) but cannot nail it down.

What are the other possible locations / what path should be provided to IdentityFile here?

Thank you

WSL is a bit of a red-herring here. When you are using the " Remote - SSH " extension in VSCode, you aren't going through WSL at all. As you can see from this line in the output...

[17:38:25.713] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

... It's using OpenSSH for Windows.

The location for your private key in OpenSSH should be %userprofile%/.ssh (so something like C:\Users\username\.ssh ). Try placing it there. Also try executing your ssh command from PowerShell or cmd rather than WSL, since that's the one being used by VSCode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM