On this page
On this page
Hosting
Ansible
Deploy OpenClaw to production servers with openclaw-ansible, an automated installer with a security-first architecture.
Prerequisites
| Requirement | Details |
|---|---|
| OS | Debian 11+ or Ubuntu 20.04+ |
| Access | Root or sudo privileges |
| Network | Internet connection for package installation |
| Ansible | 2.14+ (installed automatically by the quick-start script) |
What you get
- Firewall-first security: UFW + Docker isolation (only SSH reachable, plus Tailscale when enabled)
- Optional Tailscale VPN for remote access without exposing services publicly
- Docker for isolated sandbox containers with localhost-only bindings
- A dedicated unprivileged
openclawuser with scoped sudo, ready foropenclaw onboard --install-daemon - One-command setup
Quick start
What gets installed
- Tailscale (mesh VPN), only when
tailscale_enabled=true - UFW firewall (SSH only, plus Tailscale when enabled), fail2ban for SSH, and unattended security upgrades
- Docker CE + Compose V2 (default agent sandbox backend)
- Node.js from NodeSource (major version set by
nodejs_version) and pnpm. OpenClaw accepts Node 24.16.0+ on 24.x or 26.1.0+; 24.22.1+/26.12.1+ is strongly recommended for security. Checknode --versionafter the install. - OpenClaw, installed host-based with pnpm as the
openclawuser, not containerized
The playbook does not create openclaw.json or a Gateway service. Onboarding does both: it installs the Gateway as the systemd user service openclaw-gateway.service of the openclaw user. The installer does not add systemd sandboxing directives (such as NoNewPrivileges or PrivateTmp) to that unit.
Post-install setup
Switch to the openclaw user
Run onboarding and install the Gateway service
Connect messaging channels
Log in to WhatsApp, Telegram, Discord, or Signal:
Verify the installation
Connect to Tailscale (optional)
If you installed with tailscale_enabled=true, join your VPN mesh for secure remote access.
Quick commands
Run these as the openclaw user (sudo -i -u openclaw):
openclaw gateway restart records managed restart intent. For a system-scope service, follow the exact sudo systemctl restart <unit> command it prints.
Security architecture
Four-layer defense model:
- Firewall (UFW): only SSH (22) exposed publicly, plus Tailscale (41641/udp) when enabled
- Loopback Gateway: the installer does not change OpenClaw's default loopback bind; reach it through an SSH tunnel or Tailscale Serve
- Docker isolation:
DOCKER-USERiptables chain prevents external port exposure - Unprivileged user: the Gateway runs as
openclawwith scoped sudo and without membership in the root-equivalentdockergroup
The installer does not harden the Gateway's systemd unit. Inspect it as the openclaw user with systemctl --user show openclaw-gateway.service -p NoNewPrivileges -p PrivateTmp -p ProtectSystem.
Check which ports are publicly reachable:
Only port 22 (SSH) should be open. Gateway and Docker stay locked down.
Docker is installed for agent sandboxes (isolated tool execution), not for running the gateway. See Multi-agent sandbox and tools for sandbox configuration.
Manual installation
Install prerequisites
Clone the repository
Install Ansible collections
Run the playbook
Or run the playbook directly, then continue with Post-install setup:
Updating
The Ansible installer sets up OpenClaw for manual updates; see Updating for the standard flow.
To re-run the playbook (for example, after configuration changes):
You can run this multiple times without duplicating its effects.
Troubleshooting
Firewall blocks my connection
- SSH (port 22) is always allowed. The Gateway listens on loopback; use an SSH tunnel or Tailscale Serve.
Service will not start
Run these as the openclaw user (sudo -i -u openclaw):
Docker sandbox issues
Run these from your administrator account, not as openclaw: the
openclaw user has neither Docker access nor general sudo rights.
If the image is missing, build it from a source checkout that your administrator account owns, not from a checkout the openclaw user can write to. See Images and setup.
Channel login fails
Make sure you are running as the openclaw user:
Advanced configuration
For detailed security architecture and troubleshooting, see the openclaw-ansible repo:
Related
- openclaw-ansible: full deployment guide
- Docker: containerized gateway setup
- Sandboxing: agent sandbox configuration
- Multi-agent sandbox and tools: per-agent isolation