Remote Gateway Setup
SSH tunnel setup for connecting OpenClaw.app to a remote Gateway.
OpenClaw.app uses SSH tunnels to connect to remote gateways. This guide explains how to set it up.
Overview
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client Machine β
β β
β OpenClaw.app βββΊ ws://127.0.0.1:18789 (local port) β
β β β
β βΌ β
β SSH Tunnel βββββββββββββββββββββββββββββββββββββββββββββββββ
β β β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Remote Machine β
β β
β Gateway WebSocket βββΊ ws://127.0.0.1:18789 βββΊ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββQuick Setup
#
Step 1: Add SSH config
Edit ''~/.ssh/config'' and add:
Host remote-gateway
HostName '<REMOTE_IP>' # e.g., 172.27.187.184
User '<REMOTE_USER>' # e.g., jefferson
LocalForward 18789 127.0.0.1:18789
IdentityFile ~/.ssh/id_rsaReplace ''<REMOTE_IP>'' and ''<REMOTE_USER>'' with your values.
#
Step 2: Copy SSH key
Copy your public key to the remote machine (enter password once):
ssh-copy-id -i ~/.ssh/id_rsa '<REMOTE_USER>'@'<REMOTE_IP>'
#
Step 3: Set Gateway token
launchctl setenv OPENCLAW_GATEWAY_TOKEN "'<your-token>'"
#
Step 4: Start SSH tunnel
ssh -N remote-gateway &
#
Step 5: Restart OpenClaw.app
open /path/to/OpenClaw.app
The app will connect to the remote gateway via the SSH tunnel.
Troubleshooting
Check if tunnel is running:
ps aux | grep "ssh -N remote-gateway" | grep -v grep lsof -i :18789
Restart the tunnel:
launchctl kickstart -k gui/$UID/bot.molt.ssh-tunnel
Stop the tunnel:
launchctl bootout gui/$UID/bot.molt.ssh-tunnel
--- |
ReferenceGatewayRemoteGatewayReadmePage.step08.item1
ReferenceGatewayRemoteGatewayReadmePage.step08.item2
ReferenceGatewayRemoteGatewayReadmePage.step08.item3
ReferenceGatewayRemoteGatewayReadmePage.step08.item4
OpenClaw.app connects to ''ws://127.0.0.1:18789'' on the client machine. The SSH tunnel forwards that connection to port 18789 on the remote machine where the gateway is running.