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

通过qlogin配置SSH跳板机登录GPU节点失败求助

解决VS Code中SSH配置GPU节点qlogin不生效的问题

现有可正常使用的SSH跳板机配置

#jump-box host
Host name
  HostName <hostNameAddress>
  User foo
  IdentityFile ~/.ssh/id_rsa
  PubkeyAuthentication yes
  IdentitiesOnly yes
  ForwardAgent yes
 
#jump-box target
Host jumpboxTarget
  HostName <targetAddress>
  User foo
  IdentityFile ~/.ssh/id_rsa
  PubkeyAuthentication yes
  IdentitiesOnly yes
  ProxyJump name
  ForwardAgent yes

问题描述

配置nameGPU主机后,VS Code始终直接登录到登录节点(<hostNameAddress>),RemoteCommand中的qlogin命令和|| exit 1逻辑完全被忽略,无法进入GPU节点运行Jupyter Notebook。

解决方案

1. 调整VS Code的Remote-SSH扩展设置

VS Code默认会忽略SSH配置中的RemoteCommand,需要手动开启支持:

  • 打开VS Code设置(快捷键Ctrl+,)
  • 搜索remote.SSH.useLocalServer,取消勾选该选项
  • 搜索remote.SSH.enableRemoteCommand,勾选该选项

2. 修正nameGPU的SSH配置

用bash -c包裹命令,确保shell能正确解析||逻辑,调整后的配置如下:

Host nameGPU
  HostName <hostNameAddress>
  User foo
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes
  ForwardAgent yes
  UseKeychain yes
  RequestTTY force
  RemoteCommand bash -c "qlogin -q gpu -l gpu=1 -now y || exit 1"
  ServerAliveInterval 60
  ServerAliveCountMax 120

3. 先在终端验证连接

先在本地终端执行ssh nameGPU,确认能成功进入GPU节点后,再回到VS Code选择nameGPU进行连接,避免VS Code的缓存影响。

4. Jupyter Notebook的端口转发配置(可选)

如果要在GPU节点运行Jupyter Notebook,可在SSH配置中添加端口转发规则,或者连接成功后手动操作:

  • 连接GPU节点后,执行:jupyter notebook --no-browser --port=8888
  • 在本地终端执行端口转发:ssh -L 8888:localhost:8888 nameGPU,即可在本地浏览器访问Jupyter

内容的提问来源于stack exchange,提问作者Masoud Ghaderi

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.12 03:57:03