Void.app 使用 open-remote-ssh 插件连接 Windows 远程主机指南
目录
🚀 Void.app 使用 open-remote-ssh 插件连接 Windows 远程主机指南
本文档适用于第三方 VSCode 编辑器(如 Void.app)使用
jeanp413.open-remote-ssh
插件远程连接 Windows 主机。
🧱 背景
微软官方 remote-ssh
插件仅支持在 Visual Studio Code 中运行,不兼容第三方编辑器。为此,open-remote-ssh
作为开源替代品提供了类似功能。但在连接远程 Windows 主机 时存在一些特定限制,需要手动配置支持。
✅ 环境要求
-
本地编辑器:Void.app / VSCode OSS
-
远程主机:Windows 10+,已开启 SSH 服务
-
可通过
.ssh/config
配置无密码登录(使用公钥)
🛠️ 完整配置步骤
🔧 第一步:配置 Windows 默认 shell 为 PowerShell
Windows SSH 默认使用 cmd.exe
,这会导致安装脚本失败。需将其替换为 PowerShell:
➤ 在 Windows PowerShell(管理员权限)下执行:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShellCommandOption -Value "/c" -PropertyType String -Force
💡 重启
sshd
服务或重启主机生效:
Restart-Service sshd
🔧 第二步:禁用 SSH Agent 转发
open-remote-ssh
在连接时会尝试开启 agent forwarding
,这在 Windows 上 会导致连接失败。
➤ 编辑本地 .ssh/config
,添加:
Host win11
HostName 192.168.1.100
User youruser
ForwardAgent no
⚠️ 第三步:手动部署 void-server
到远程 Windows
由于 GitHub 下载经常失败,这时候只能手动安装:
1. 获取插件版本和 Commit(示例):
DISTRO_VERSION="1.99.30044"
DISTRO_COMMIT="b5a41840a0ce29fe5a86b2fa07c26b07f92684d2"
2. 本地下载对应版本安装包:
curl -LO https://github.com/voideditor/binaries/releases/download/1.99.30044/void-reh-win32-x64-1.99.30044.tar.gz
3. 上传到远程主机指定目录(使用 Git Bash 或 scp):
scp void-reh-win32-x64-1.99.30044.tar.gz youruser@yourhost:/c/Users/youruser/.void-server/bin/b5a41840a0ce29fe5a86b2fa07c26b07f92684d2/
4. SSH 登录远程主机,手动解压:
cd $HOME/.void-server/bin/b5a41840a0ce29fe5a86b2fa07c26b07f92684d2
tar -xf void-reh-win32-x64-1.99.30044.tar.gz --strip-components 1
解压后应包含:
C:\Users\youruser\.void-server\
└── bin\
└── b5a41840a0ce29fe5a86b2fa07c26b07f92684d2\
└── bin\
└── void-server.cmd ✅
✅ 第四步:使用插件连接 Windows
-
启动 Void.app
-
打开命令面板:
Remote-SSH: Connect to Host...
-
选择你的
win11
配置
插件会自动检测 void-server
已安装并启动远程服务。
✅ 总结
步骤 | 内容 |
---|---|
✅ 设置 Windows SSH 默认 shell | 使用 PowerShell 替代 CMD |
✅ 禁用 SSH Agent Forwarding | 防止连接失败 |
✅ 手动部署 void-server |
下载解压到对应 commit 目录 |
✅ 插件连接远程 | 连接稳定,不需重复安装 |