visual-studio-code - Remote SSH on VS Code in WSL2 password prompt
问题描述
I am trying to connect to my server via SSH in VS Code for Ubuntu WSL2. However, whenever I make a connection, it is using the windows SSH instead of my Ubuntu WSL2. Is there anyway to start the remote SSH terminal in Ubuntu instead of the default Windows command prompt?
[10:14:37.201] Log Level: 2
[10:14:37.205] remote-ssh@0.62.0
[10:14:37.205] win32 x64
[10:14:37.208] "remote.SSH.sshPath": /usr/bin/ssh
[10:14:37.208] "remote.SSH.sshConfigurationFile": ~/.ssh/config
[10:14:37.245] Checking ssh with "/usr/bin/ssh -V"
[10:14:37.251] Got error from ssh: spawn /usr/bin/ssh ENOENT
[10:14:37.251] The specified path /usr/bin/ssh is not a valid SSH binary
[10:14:37.252] Checking ssh with "ssh -V"
[10:14:37.296] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[10:14:37.300] Using SSH config file "~/.ssh/config"
[10:14:37.300] Running script with connection command: ssh -T -D 60054 -F "~/.ssh/config" "test-wsl" bash
[10:14:37.303] Terminal shell path: C:\WINDOWS\System32\cmd.exe
解决方案
如果其他人遇到与我相同的问题,似乎 VS Code 中的远程服务器正在选择 cmd 作为默认终端,因此我必须将我的私钥复制到/mnt/c/Users/{user}/.ssh
目录中才能使基于 ssh 密钥的身份验证工作。如果我可以将默认 shell 更改为C:\WINDOWS\System32\bash.exe
.
推荐阅读
- java - ImageIO 在读取文件时在做什么?
- function - 功能
在飞镖? - python-3.x - Rasperry Pi 上的 PIP3 异常
- angular - Angular Material 7.3 mat-card 更改
- selenium - 在 chrome/firefox 控制台中找到 xpath,但 selenium 没有找到?
- angular - 无法在功能上设置时间间隔
- java - 具有未来兼容性且不会破坏未来修改的类
- ios - 使用 Theos 使用“系统”命令编译错误
- javascript - 表单填充后启用按钮 Javascript - Swift
- c# - 二叉搜索树删除功能