If your agent needs to stay available when your laptop is closed, a VPS can host its gateway and workspace. With OpenClaw, that server becomes a place that holds state, files and sometimes access to other tools. It deserves more than an open port and a hastily chosen password.
This approach is for a gateway installed directly on a Linux server. Docker requires different network bindings and published ports. Mixing the two tutorials is a good way to make a service unreachable or too reachable.
Keep administration private
OpenClaw’s documentation recommends preferring a loopback binding with access through SSH or Tailscale. Keep gateway authentication enabled too. A tunnel reduces network exposure but does not replace every access control.
Before these commands, prepare a dedicated account and working key-based SSH access. Verify the server’s host key. The name deploy and the address below are examples. The gateway must already be installed. Restart its service after changing the configuration.
# On the VPS, as the account running OpenClaw
openclaw config set gateway.bind loopback
# After restarting the service, inspect listening sockets
ss -lnt
# On your computer, keep this tunnel open
ssh -N -o ExitOnForwardFailure=yes \
-L 127.0.0.1:18789:127.0.0.1:18789 \
deploy@vps.example.com
# Then open http://127.0.0.1:18789
Do not give it your personal session
Avoid copying your browser profile, password manager or a key that can access all your projects. Give the agent the folders and accounts required for its task. Do not mount the Docker socket into its environment just to make things easier. That shortcut can give it extensive control over the host.
Do not expose the gateway port in your provider’s firewall. Check from another machine that it is closed, including over IPv6 if the server has it. Before tightening SSH access, keep one session open and test a second connection to avoid locking yourself out.
Know where the data goes
Hosting OpenClaw yourself does not mean the model runs there too. If the configuration calls an external API, the content needed for those calls leaves the VPS. Check the provider’s rules and back up useful state off the server. A backup only becomes reassuring after a restore test.