【问题标题】:How to fix VS Code error with Remote-SSH: "the terminal process failed to launch: A native exception occurred during launch (forkpty(3) failed.)."?如何使用 Remote-SSH 修复 VS Code 错误:“终端进程无法启动:启动期间发生本机异常(forkpty(3)失败。)。”?
【发布时间】:2026-01-06 21:05:01
【问题描述】:

我已经在 VS Code 中安装并使用了 Remote-SSH 扩展来访问 Linux 暂存环境并远程工作。

设置和连接适用于一个用户,但不允许我以不同用户的身份连接(在同一台服务器上)。

连接后立即弹出错误提示the terminal process failed to launch: A native exception occurred during launch (forkpty(3) failed.).,终端将无法打开。如果我尝试手动打开终端,它将失败并出现同样的错误。

这是我的 Remote-SSH 配置文件的外观示例:

Host configfile1
  HostName host.website.com
  User username1
  IdentifyFile "[key file path]"

Host configfile2
  HostName host.website.com
  User username2
  IdentifyFile "[key file path]"

我可以正常连接并使用configfile1 打开远程终端,但是在尝试使用configfile2 连接时会遇到上述错误。

我尝试了这个 GitHub 问题线程中提到的各种解决方案,但无济于事:https://github.com/microsoft/vscode-remote-release/issues/4233

有人对此有解决方案吗?

【问题讨论】:

    标签: shell visual-studio-code ssh terminal vscode-remote


    【解决方案1】:

    我不知道造成这种情况的根本原因,但是在使用 jailed shell 设置时会弹出此错误。

    尝试将用户的 SSH shell 设置更改为 普通 shell,您可能可以毫无问题地连接。

    然而,这可能不是所有场景或安全考虑的理想选择,但它允许 Remote-SSH 连接并生成终端。

    【讨论】:

      最近更新 更多