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

VSCode连接远程Linux服务器报错:安装脚本返回异常结果

解决VSCode远程SSH连接"Got bad result from install script"报错

问题详情

使用VSCode连接远程Linux服务器时触发Error: Got bad result from install script报错,连接其他服务器也存在相同问题,但通过Termius可正常连接。报错日志如下:

[16:15:30.450] Opening exec server for ssh-remote+linux9
[16:15:30.517] Initizing new exec server for ssh-remote+linux9
[16:15:30.533] Using commit id "8b617bd08fd9e3fc94d14adb8d358b56e3f72314" and quality "stable" for server
[16:15:30.535] Install and start server if needed
[16:15:30.625] Using SSH config file "C:\Users\lenovo\.ssh\config"
[16:15:30.626] Running script with connection command: "C:\WINDOWS\System32\OpenSSH\ssh.exe" -T -o ClearAllForwardings=true -F "C:\Users\lenovo\.ssh\config" linux9 bash
[16:15:30.628] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[16:15:32.059] "install" terminal command done
[16:15:32.060] Install terminal quit with output: 
[16:15:32.060] Exec server for ssh-remote+linux9 failed: Error: Got bad result from install script
[16:15:32.060] Error opening exec server for ssh-remote+linux9: Error: Got bad result from install script

解决方法

  • 检查本地OpenSSH版本:打开CMD执行ssh -V,若版本低于8.0.x,前往微软官网更新Windows系统自带的OpenSSH组件。
  • 启用登录终端手动验证:打开VSCode设置,搜索remote.SSH.showLoginTerminal并勾选,连接时会弹出终端让你手动完成身份验证,跳过自动安装脚本的静默执行流程。
  • 校验SSH配置文件:打开C:\Users\lenovo\.ssh\config,确保配置格式正确,示例:
    Host linux9
        HostName 你的服务器IP/域名
        User 服务器登录用户名
        Port 22
    
    移除配置中多余的注释或特殊字符。
  • 切换远程服务器安装模式:打开VSCode设置,搜索remote.SSH.useLocalServer并取消勾选,强制使用远程端的VSCode Server安装逻辑。
  • 清除VSCode远程缓存:删除C:\Users\lenovo\.vscode\extensions\ms-vscode-remote.remote-ssh-*\out\server路径下的所有缓存文件,重启VSCode后重试连接。

内容的提问来源于stack exchange,提问作者Xiwen Wu

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.11 16:19:58