本页内容已合并到 gateway-remote,以下为快速参考。
OpenClaw.app 通过 SSH 隧道连接远程 Gateway,本地监听 ws://127.0.0.1:18789,隧道转发到远程主机同端口。
快速配置步骤
1. 配置 SSH
# ~/.ssh/config
Host remote-gateway
HostName <REMOTE_IP>
User <REMOTE_USER>
LocalForward 18789 127.0.0.1:18789
IdentityFile ~/.ssh/id_rsa2. 复制 SSH 公钥
ssh-copy-id -i ~/.ssh/id_rsa <REMOTE_USER>@<REMOTE_IP>3. 配置 Gateway Token
openclaw config set gateway.remote.token "<your-token>"
# 或 password 认证:
openclaw config set gateway.remote.password "<your-password>"4. 启动隧道
ssh -N remote-gateway &5. 重启 OpenClaw.app
自动启动(LaunchAgent)
# 加载 LaunchAgent(见 gateway-remote.md 中的完整 plist)
launchctl bootstrap gui/$UID ~/Library/LaunchAgents/ai.openclaw.ssh-tunnel.plist组件说明
| 组件 | 作用 |
|---|---|
LocalForward 18789 127.0.0.1:18789 | 本地端口转发到远程 18789 |
ssh -N | 仅端口转发,不执行远程命令 |
KeepAlive | 隧道崩溃后自动重启 |
RunAtLoad | 登录时自动启动 |
故障排查
# 检查隧道是否运行
ps aux | grep "ssh -N remote-gateway" | grep -v grep
lsof -i :18789
# 重启隧道
launchctl kickstart -k gui/$UID/ai.openclaw.ssh-tunnel
# 停止隧道
launchctl bootout gui/$UID/ai.openclaw.ssh-tunnel