繁体   English   中英

在 WSL2 密码提示中的 VS Code 上远程 SSH

[英]Remote SSH on VS Code in WSL2 password prompt

我正在尝试通过 Ubuntu WSL2 的 VS 代码中的 SSH 连接到我的服务器。 但是,每当我建立连接时,它都会使用 windows SSH 而不是我的 Ubuntu WSL2。 无论如何要在 Ubuntu 中启动远程 SSH 终端,而不是默认的 Windows 命令提示符?

[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会更好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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