Remote Access
Điều khiển Gateway từ xa bằng CLI hoặc UI.
The Concept
Thay vì chạy OpenClaw trên laptop (tốn pin, nóng máy), bạn chạy nó trên một VPS hoặc Home Server mạnh mẽ. Laptop của bạn chỉ đóng vai trò là Remote Controller.
graph LR
Laptop[Laptop (CLI/UI)] -->|WebSocket (Secure)| Server[Home Server (Gateway)]
Server -->|Run| Agent1[Agent]
Server -->|Run| Agent2[Agent]
Setup Server
- Install OpenClaw trên server.
- Start Gateway:
openclaw gateway start - Get Token:
openclaw gateway status --show-token
# Output: eyJhbGciOiJIUzI1Ni... - Expose Port:
- Dùng Tailscale (Recommended):
100.x.y.z:18789 - Hoặc SSH Tunnel:
ssh -L 18789:localhost:18789 user@server
- Dùng Tailscale (Recommended):
Setup Client (Laptop)
Trên laptop của bạn, không cần chạy openclaw gateway start.
1. One-time Setup
openclaw setup --remote-url ws://100.x.y.z:18789 --remote-token <your-token>
(Thay IP bằng IP Tailscale hoặc localhost nếu dùng SSH Tunnel)
2. Verify
openclaw health
Output sẽ hiện: Gateway: Remote (ws://...) ✅
3. Use as Normal
Tất cả commands CLI giờ sẽ chạy trên server:
openclaw models list # Lists models on server
openclaw agents list # Lists agents on server
Web UI Remote
Nếu bạn dùng Web UI (http://localhost:18789), bạn có thể trỏ nó tới remote gateway bằng param:
http://localhost:18789/?gateway=ws://100.x.y.z:18789&token=...
Tuy nhiên, khuyến khích dùng Tailscale DNS để truy cập trực tiếp UI trên server:
http://openclaw-server.tailnet-name.ts.net:18789
Security Best Practices
- Never expose port 18789 ra public internet trực tiếp.
- Luôn dùng Tailscale hoặc VPN.
- Nếu phải expose public, bắt buộc dùng Reverse Proxy (Nginx) + SSL.
- Rotate token định kỳ nếu nghi ngờ lộ.