You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.14 09:50:30