CC BY 4.0 (除特别声明或转载文章外)
如果这篇博客帮助到你,可以请我喝一杯咖啡~
问题描述
我通过 VSCode 上的 Remote SSH 连接到 DGX-Station
,其中需要通过 ac5
进行一次跳转。以下是 C:\Users\wukan\.ssh\config
中的部分内容。
1
2
3
4
5
6
7
8
9
# *号表示保密内容
Host DGX-Station
HostName ***.***.***.***
User ***** # 保密
ProxyJump ac5
Host ac5
HostName ***.***.***.*** # 这一项保密
User *****
在更新到 [email protected] 前可以正常连接上 DGX-Station
,然而今天更新到 1.43.1 后出现了连接报错的问题。以下是运行时的 Log。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
[14:02:27.150] Log Level: 2
[14:02:27.154] [email protected]
[14:02:27.154] win32 x64
[14:02:27.156] SSH Resolver called for "ssh-remote+7b22686f73744e616d65223a224447582d53746174696f6e227d", attempt 1
[14:02:27.156] SSH Resolver called for host: DGX-Station
[14:02:27.156] Setting up SSH remote "DGX-Station"
[14:02:27.160] Acquiring local install lock: C:\Users\wukan\AppData\Local\Temp\vscode-remote-ssh-DGX-Station-install.lock
[14:02:27.179] Looking for existing server data file at c:\Users\wukan\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-ssh\vscode-ssh-host-DGX-Station-fe22a9645b44368865c0ba92e2fb881ff1afce94-0.50.1\data.json
[14:02:27.180] Using commit id "fe22a9645b44368865c0ba92e2fb881ff1afce94" and quality "stable" for server
[14:02:27.181] Install and start server if needed
[14:02:27.186] Checking ssh with "ssh -V"
[14:02:27.250] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[14:02:27.251] Checking ssh with "C:\WINDOWS\System32\OpenSSH\ssh.exe -V"
[14:02:27.302] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[14:02:27.302] Checking ssh with "C:\Program Files\Git\usr\bin\ssh.exe -V"
[14:02:27.374] > OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
[14:02:27.379] Using SSH config file "C:\Users\wukan\.ssh\config"
[14:02:27.380] askpass server listening on \\.\pipe\vscode-ssh-askpass-c2d72e421fd1baa25cc036ea7fad59f23912723a-sock
[14:02:27.380] Spawning local server with {"ipcHandlePath":"\\\\.\\pipe\\vscode-ssh-askpass-367cfd2f8fd33a776e6b45cdd71c9c6a40bdabde-sock","sshCommand":"C:\\Program Files\\Git\\usr\\bin\\ssh.exe","sshArgs":["-v","-T","-D","2869","-F","C:\\Users\\wukan\\.ssh\\config","DGX-Station"],"dataFilePath":"c:\\Users\\wukan\\AppData\\Roaming\\Code\\User\\globalStorage\\ms-vscode-remote.remote-ssh\\vscode-ssh-host-DGX-Station-fe22a9645b44368865c0ba92e2fb881ff1afce94-0.50.1\\data.json"}
[14:02:27.381] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"c:\\Users\\wukan\\.vscode\\extensions\\ms-vscode-remote.remote-ssh-0.50.1\\out\\local-server\\askpass.bat","VSCODE_SSH_ASKPASS_NODE":"C:\\Users\\wukan\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe","VSCODE_SSH_ASKPASS_MAIN":"c:\\Users\\wukan\\.vscode\\extensions\\ms-vscode-remote.remote-ssh-0.50.1\\out\\askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"\\\\.\\pipe\\vscode-ssh-askpass-c2d72e421fd1baa25cc036ea7fad59f23912723a-sock"}
[14:02:27.394] Spawned 5100
[14:02:27.498] > local-server> Spawned ssh: 4944
[14:02:27.537] stderr> OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
[14:02:27.641] stderr> OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
[14:02:27.641] stderr> Can't open user config file C:Userswukan.sshconfig: No such file or directory
[14:02:27.641] stderr> kex_exchange_identification: Connection closed by remote host
[14:02:27.666] > local-server> ssh child died, shutting down
[14:02:27.674] Local server exit: 0
[14:02:27.674] Received install output: OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
Can't open user config file C:Userswukan.sshconfig: No such file or directory
kex_exchange_identification: Connection closed by remote host
[14:02:27.675] Stopped parsing output early. Remaining text: OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019Can't open user config file C:Userswukan.sshconfig: No such file or directorykex_exchange_identification: Connection closed by remote host
[14:02:27.675] Failed to parse remote port from server output
[14:02:27.676] Resolver error:
[14:02:27.679] ------
此外,连接不需要跳转的节点(例如 ac5
)没有出现问题。
解决方案
从 [14:02:27.641] stderr> Can't open user config file C:Userswukan.sshconfig: No such file or directory
这一行报错来看,新版本更新后似乎将 ssh_config 的地址C:\Users\wukan\.ssh\config
中的\
识别成转移符号了。目前我在本地 vscode 找到这一项设置:@ext:ms-vscode-remote.remote-ssh,ms-vscode-remote.remote-ssh-edit config file
,将其值由空改成 C:\\Users\\wukan\\.ssh\\config
,这样暂时解决了问题。我已经提了 issue,还要等官方来修复了。