VSCode Remote SSH连接组织JupyterHub服务器失败:无法解析远程端口
问题:VSCode Remote SSH连接JupyterHub失败,报错“Failed to parse remote port from server output”
尝试使用VSCode的Remote SSH扩展连接所在组织的JupyterHub服务器时,连接过程崩溃,核心报错为Failed to parse remote port from server output,完整报错日志如下:
[17:48:27.180] Running script with connection command: ssh -T -D 56752 "jupyterhub.whatever.com" bash [17:48:27.183] Terminal shell path: C:\WINDOWS\System32\cmd.exe [17:48:27.575] > 系统无法执行指定的程序。 > ]0;C:\WINDOWS\System32\cmd.exe [17:48:27.576] Got some output, clearing connection timeout [17:48:28.857] "install" terminal command done [17:48:28.858] Install terminal quit with output: ]0;C:\WINDOWS\System32\cmd.exe [17:48:28.858] Received install output: ]0;C:\WINDOWS\System32\cmd.exe [17:48:28.858] Failed to parse remote port from server output [17:48:28.859] Resolver error: Error: at g.Create (c:\Users\k6789\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:585222) at t.handleInstallOutput (c:\Users\k6789\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:583874) at t.tryInstall (c:\Users\k6789\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:681023) at process.processTicksAndRejections (node:internal/process/task_queues:96:5) at async c:\Users\k6789\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:643908 at async t.withShowDetailsEvent (c:\Users\k6789\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:647224) at async t.resolve (c:\Users\k6789\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:644958) at async c:\Users\k6789\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:726917 [17:48:28.863] ------
当前使用的SSH配置:
Host jupyterhub.whatever.com HostName jupyterhub.whatever.com IdentityFile ~/.ssh/id_rsa PreferredAuthentications publickey User MyUserName
解决方案
- 验证本地SSH可用性:打开CMD执行
ssh jupyterhub.whatever.com,确认能否正常登录远程服务器。如果本地无法运行SSH,先在Windows设置-应用-可选功能中添加OpenSSH客户端。 - 指定远程Shell路径:在SSH配置中添加一行
Shell /bin/bash(若远程服务器bash路径不同,可先登录远程执行which bash获取正确路径),若bash不可用,尝试替换为Shell /bin/sh。修改后的配置示例:Host jupyterhub.whatever.com HostName jupyterhub.whatever.com IdentityFile ~/.ssh/id_rsa PreferredAuthentications publickey User MyUserName Shell /bin/bash - 升级Remote SSH扩展:当前使用的0.90.1版本较旧,存在已知兼容性问题,前往VSCode扩展商店将Remote - SSH扩展更新至最新版本后重试。
- 更换VSCode默认终端:VSCode默认使用CMD作为终端,可能存在执行异常。在VSCode设置中搜索
terminal.integrated.defaultProfile.windows,将默认终端改为PowerShell或Git Bash,重启VSCode后重新尝试连接。 - 检查远程用户Shell权限:登录远程服务器后,确认当前用户拥有执行指定Shell的权限,若权限不足,联系服务器管理员调整。
内容的提问来源于stack exchange,提问作者forestbat
相关产品推荐
相关产品推荐

