Redock 连接 Windows 走的是 SSH,不是远程桌面。要把 Windows PC 作为 Redock Host,需要开启 Microsoft OpenSSH Server,启动 sshd 服务,并确保 iPhone 或 iPad 能访问 TCP 22 端口。
准备条件
- 使用 Windows 10、Windows 11、Windows Server 2019、Windows Server 2022 或 Windows Server 2025。
- 当前账号有安装可选功能的权限。
- iPhone 或 iPad 和 Windows PC 位于同一局域网、Tailscale 网络、ngrok TCP endpoint,或其他可达网络路径。
- 长期使用建议配置 SSH Key。
通过设置安装
- 打开 Settings。
- 搜索 Optional Features。
- 打开 Add an optional feature。
- 搜索 OpenSSH Server。
- 安装 OpenSSH Server。
- 打开 Services。
- 找到 OpenSSH SSH Server。
- 将 Startup type 设为 Automatic。
- 启动服务。
安装 OpenSSH Server 通常会创建允许 TCP 22 入站的 Windows 防火墙规则。如果 Redock 无法连接,先检查这条规则是否启用。
通过 PowerShell 安装
以管理员身份打开 PowerShell,执行:
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Server*'
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
Set-Service -Name sshd -StartupType Automatic
如果防火墙规则缺失,可以创建:
New-NetFirewallRule -Name OpenSSH-Server-In-TCP -DisplayName "OpenSSH Server (sshd)" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
检查服务状态:
Get-Service sshd
找到 Windows 地址
同一局域网下,可以查看 Windows IP:
ipconfig
使用当前 Wi-Fi 或有线网卡的 IPv4 地址,例如 192.168.1.35。
确认 Windows 用户名:
whoami
如果 whoami 输出 DESKTOP-1234\alex,Redock 里可以先尝试填写 alex。域账号或受管账号需要使用当前 Windows OpenSSH 配置接受的账号格式。
Redock Host 配置
Name: Windows PC
Host: 192.168.1.35
Port: 22
Username: alex
Connection Mode: SSH
Auth: Password 或 SSH Key
连接成功后通常会进入 Windows 为 OpenSSH 配置的默认 shell。路径和命令是 Windows 风格,例如:
cd C:\Users\alex\Projects\my-app
git status
Windows 上的 SSH Key
如果使用 key 认证,把 Redock public key 添加到:
C:\Users\alex\.ssh\authorized_keys
确认这个文件属于对应 Windows 用户。如果 key 被拒绝,可以在 Event Viewer 里查看 OpenSSH 日志,并检查 .ssh 和 authorized_keys 的权限。
常见问题
- Connection refused:
sshd没有运行、22端口被阻断,或防火墙规则未启用。 - Connection timed out:IP 地址错误、设备不在同一网络,或网络阻断入站 TCP。
- Authentication failed:检查 Windows 用户名、密码、SSH key 和账号策略。
- command not found:需要在 Windows 上安装 Git、Node、Python 或 AI coding agent,并确认它在 OpenSSH shell 的
PATH中。