Secure OpenClaw Setup on Hetzner VPS in 90 Minutes (The Budget-Safe Way)
Learn how to securely set up OpenClaw on Hetzner VPS with Tailscale VPN in 60 minutes, saving costs and protecting your AI agents from exposure. Start today.
42,665 exposed OpenClaw instances were found last month.
Security researcher Maor Dayan scanned the internet in February 2026. He found 42,665 OpenClaw instances with public access. 93.4% had authentication bypasses.
Anyone could control the agents, read conversations, or inject commands. That’s 39,847 AI agents running with their front doors wide open.
You don’t want to be one of them.
How do I set up OpenClaw securely without spending hours on DevOps?
Follow the Security-First Setup pattern: Tailscale VPN before OpenClaw install, firewall rules before Docker, burner accounts before connecting real data. This takes 90 minutes and costs under $20/month.
Every OpenClaw guide I found follows the same pattern: “Get it working first, secure it later.” That’s how you end up exposed.
This guide wires the alarm system during construction, not after move-in day. You’ll have a production-ready ClawBot/OpenClaw AI agent running 24/7 on Hetzner Cloud, accessible only via Tailscale, with zero public ports. All for ~$5/month plus API costs.
By the end, you’ll have:
a secure OpenClaw instance running 24/7 with a default agent responding to Telegram messages,
foundational infrastructure which is ready for custom AI agents like email triage, content research, calendar management (which we’ll build in the next article.)
Total setup time: 90 minutes.
Total monthly cost: under $20.
👋 Julley, I'm Dheeraj, an AI systems builder.
I build production-grade AI systems at work by day and ship my own products by night, 9 and counting, including SubflowAI and the Content OS Agents Toolkit. This newsletter is the bridge between those two worlds. Every system, every build, documented step by step.
Join 1,800+ builders getting the exact AI setups, prompts, and workflows that actually work in your business.
Why Choose Hetzner and Tailscale for Secure OpenClaw Setup?
Recently a friend running a local learning center for kids in my region wanted my help to set up a secure ClawBot / OpenClaw AI Agent to triage her emails. But she wasn’t sure about the security and the cost running OpenClaw setup.
That’s when I started testing this set up to deploy required autonomous AI Agents for her that can report via Telegram or Whatsapp.
She is not that technical. So I build an OpenClaw Autopilot for her so that she can replicate this exact secure and cost efficient OpenClaw Agents setup just by talking in plain simple English with Claude Code.
This article is behind the scene store of my OpenClaw Autopilot. I chose this stack for two reasons:
Hetzner CX23 (~$5/month including IPv4) gives you 4GB RAM and 2 vCPU cores. That’s enough for OpenClaw Agents plus Docker overhead. AWS Lightsail and DigitalOcean equivalent will cost around $12/month. You save $100 per year.
Tailscale creates a zero-trust network. Your OpenClaw gateway gets a private 100.x.x.x IP that only your devices can reach. No public ports. No nginx reverse proxy. No SSL certificate management. It just works.
This combination optimizes for two things: cost and security. You get both without compromise.
Advanced alternative: Oracle Cloud Free Tier. If you want more headroom (24GB RAM, 4 ARM64 CPUs) at $0/month, Oracle’s Always Free tier works with OpenClaw too.
The setup is similar but needs ARM64-compatible images and Oracle’s iptables rules alongside security lists. BTW, my OpenClaw Autopilot pack (mentioned later) includes a ready-to-use Oracle docker-compose config.
Your 90-Minute Secure OpenClaw Setup Timeline
Here’s the complete setup broken into five phases:
Phase 1 (10 minutes): Burner Accounts + VPS
Create
YOUR-OpenClaw-Agent@gmail.comCreate Telegram bot via
@BotFatherProvision Hetzner CX23 VPS
Generate SSH keys
Phase 2 (15 minutes): Security Baseline
Configure UFW firewall (deny by default)
Disable password authentication
SSH key-only access
Test SSH connection
Phase 3 (20 minutes): Tailscale + Docker
Create free Tailscale account
Install Tailscale on VPS and authorize it
Install Tailscale on your laptop (both devices on same private network)
Configure UFW for Tailscale subnet
Install Docker and Docker Compose
Phase 4 (30 minutes): OpenClaw Installation on Hetzner Cloud
Clone the Docker setup repo
Pull the OpenClaw image
Run the interactive setup wizard (onboarding + token generation)
Fix Control UI origin setting for Docker
Verify gateway health
Access the dashboard via SSH tunnel through Tailscale
Phase 5 (15 minutes): Verify + First Message
Pair your Telegram account with the agent
Explore the dashboard and agent files
Send test message to confirm everything works
What you’ll have at the end:
OpenClaw running 24/7 on Hetzner with 5 security layers
Zero public ports (Tailscale-only access)
Default agent responding to Telegram messages
Infrastructure ready for custom agents (next article)
Monthly cost: ~$5 VPS + API usage (varies by provider and model)
Prerequisites for OpenClaw:
Laptop with terminal access (macOS, Linux, or WSL on Windows)
Credit card for Hetzner (~$4/month)
Comfort typing terminal commands (you don’t need to understand them)
90 minutes of focused time (plan for up to 2 hours if this is your first server setup)
Phase 1: Burner Accounts + VPS (10 Minutes)
Why Burner Accounts Matter for OpenClaw Setup
META’s AI safety director learned this the hard way in February 2026. She connected her Gmail to an OpenClaw agent for email triage. The agent lost context during a conversation thread and deleted 200+ emails trying to “clean up.” She recovered most from trash, but the lesson stuck:
Never give AI agents access to your primary accounts. (at least as of now)
Burner accounts create a firewall between your agent and your real data. If something goes wrong, you lose the burner accounts data, not your business email.
Step 1: Create Gmail (Email) Burner Account
You won’t use this email in this article - it’s for the email triage agent we’ll build in the next article. But creating it now (while you’re in setup mode) saves time later.
Go to gmail.com or other email service and create a new account:
Email:
YOUR-OpenClaw-Agent@gmail.com(or your preferred name)Use a strong password (you’ll store this in a password manager)
Skip phone verification if possible
Enable 2FA:
Go to myaccount.google.com > Security > 2-Step Verification
Create an App Password (OpenClaw needs this to connect via IMAP):
Go directly to
myaccount.google.com/apppasswords(you won’t find this in the normal Settings menu - use the direct URL)Name it “OpenClaw” and click Create
Save the 16-character password in your password manager - you’ll need it when connecting Gmail in OpenClaw
Verify IMAP is enabled:
Go to Gmail Settings (gear icon) > See all settings > Forwarding and POP/IMAP tab.
Newer Gmail accounts have IMAP enabled by default. If you see IMAP settings (auto-expunge, folder limits) but no “Enable IMAP” toggle, it’s already on. Make sure these settings are correct:
Auto-Expunge: Off (Wait for the client to update the server)
When deleted and expunged: Archive the message (not “Immediately delete”)
Optional: Create a forwarding filter for important senders:
Settings > Filters and Blocked Addresses > Create a new filter
From:
important-client@example.com→ Forward to your real emailThis lets you monitor critical messages while the agent handles routine triage
Step 2: Create Telegram Bot
Open Telegram and message @BotFather:
Send
/newbotChoose a display name (e.g., “OpenClaw Agent”)
Choose a username ending in
bot(e.g.,your_openclaw_bot)BotFather replies with an API token - save this in your password manager. You’ll need it in Step 17 during the setup wizard.
Why Telegram? OpenClaw Telegram integration is more reliable than email for real-time commands. You’ll use this to send tasks like “Research competitors for my next article” or “Add tomorrow’s meeting to my calendar.”
We will expand this OpenClaw integration to WhatsApp, iMessage communication channels in lessons to come in this course.
Step 3: Provision Hetzner VPS
Go to hetzner.com/cloud and sign up:
Choose any European datacenter (Nuremberg, Helsinki, or Falkenstein - pick whichever has CX23 available. Hetzner sometimes runs out of stock at specific locations.)
Select Ubuntu 24.04 LTS
Server type: Shared Resources > Cost-Optimized > CX23 (4GB RAM, 2 vCPU, 40GB SSD)
Networking: Keep IPv4 enabled (you need it for initial SSH access before Tailscale)
Skip everything else - Volumes, Firewalls, Backups, Placement groups, Labels, and Cloud config can all be left at defaults. We handle firewalling with UFW in Phase 2.
Give your server a name (e.g.,
openclaw-prod)Cost: ~$5/month (base $3.49 + $0.60 IPv4)
SSH Key Setup:
On your laptop, generate an SSH key:
bash
ssh-keygen -t ed25519 -C "openclaw-hetzner"Press Enter for the default location.
When it asks for a passphrase, set one. This is a security-first guide and your SSH key protects a server running AI agents.
Pick something memorable but strong.
You’ll type it once per session (or use ssh-agent to cache it):
bash
ssh-add ~/.ssh/id_ed25519That caches the key for your terminal session so you don’t retype the passphrase on every SSH command.
Copy your public key:
bash
cat ~/.ssh/id_ed25519.pubPaste this into Hetzner’s “SSH Keys” field during VPS creation.
Click “Create & Buy Now.”
Save these details:
VPS IP address:
203.0.113.42(example)SSH key location:
~/.ssh/id_ed25519
Commercial break: Claude Code Builder cohort
The founding batch of my Claude Code cohort starts in July on Maven. Four weeks, six sessions. Learn to build the AI system with me.
Only 12 Seats. When they’re gone, the founding price ($797) closes and Cohort 2 opens at $1,597.
Use code GENAI20 for 20% off. Expires July 9. Check the Syllabus →
Step 4: Test SSH Connection
Wait 60 seconds for the VPS to boot, then connect:
bash
ssh root@203.0.113.42The first time you connect, you’ll see “The authenticity of host can’t be established” with a fingerprint. Type yes to continue. This is normal. It’s your machine learning the server’s identity.
You should then see the Ubuntu welcome message with system info. If you get “Permission denied,” check that you used the correct IP and that Hetzner has your public key.
You’re 10 minutes in. The VPS is running, but it’s wide open to the internet. Phase 2 fixes that.
Phase 2: OpenClaw Security Baseline (15 Minutes)
This is where most guides skip ahead to “install Docker.” Don’t. You’re about to close every public port except SSH, disable password authentication, and create a deny-by-default firewall. This happens BEFORE OpenClaw touches the system.
Step 5: Update System Packages
Still connected via SSH, run:
bash
apt update && apt upgrade -yThis takes 2-3 minutes. Let it finish. If you see *** System restart required *** after the upgrade, run reboot and wait 30 seconds before reconnecting with ssh root@[YOUR-VPS-IP].
Step 6: Configure UFW Firewall
UFW (Uncomplicated Firewall) is Ubuntu’s firewall interface. You’re going to:
Deny all incoming traffic by default
Allow SSH (port 22) so you don’t lock yourself out
Allow Tailscale traffic (we’ll add this rule in Phase 3)
Run these commands:
bash
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw enableType y when prompted.
Verify with:
bash
ufw statusYou should see:
What this does:
Every port is now closed except SSH. When you install OpenClaw, its gateway won’t be accessible from the public internet, even if you misconfigure Docker. The firewall blocks it.
Step 7: Disable Password Authentication
Edit the SSH config:
bash
nano /etc/ssh/sshd_configFind this line (use Ctrl+W to search):
#PasswordAuthentication yesChange it to:
PasswordAuthentication no Save with Ctrl+O, Enter, then Ctrl+X to exit.
Restart SSH:
bash
systemctl restart sshWhat this does:
SSH now requires your private key. Attackers can’t brute-force passwords because password login is disabled. This stops 99% of automated SSH attacks.
Step 8: Test Security of Your OpenClaw VPS Server
Open a NEW terminal window (don’t close your SSH session yet). Try connecting:
bash
ssh root@203.0.113.42It should work (you’re using the key). Now try from a device WITHOUT the key,it will fail. That’s the goal.
You’re 25 minutes in. The VPS is now locked down. Only you can access it, and only via SSH key. Phase 3 adds the Tailscale layer.
Want to skip the copy-paste? The OpenClaw Autopilot pack includes a one-shot setup-server.sh script that runs all of Phase 2-3 automatically. You’re doing great with the manual steps though - keep going.
Phase 3: Tailscale + Docker (20 Minutes)
Tailscale creates a private network between your devices. This means your VPS gets a 100.x.x.x IP accessible only to your Tailscale devices. OpenClaw’s gateway binds to this IP, not the public internet.
Step 9: Create a Tailscale Account
Go to tailscale.com and sign up for a free account. Personal use is free for up to 100 devices. You’ll only use 2 for now (your VPS and your laptop).
Why Tailscale matters for this OpenClaw setup:
Right now your VPS has port 22 open to the entire internet. Anyone who finds your IP can attempt SSH connections. Tailscale creates a private encrypted network between your devices.
Once both your VPS and laptop are on the same Tailscale network, you can close port 22 to the public and only allow connections from inside your Tailscale network. That’s zero public ports. The core security goal of this guide.
Step 10: Install Tailscale on VPS
On your VPS (still connected via SSH), run:
bash
curl -fsSL https://tailscale.com/install.sh | shThis installs Tailscale in 30 seconds. Start it:
bash
tailscale upYou’ll see an authorization URL like:
https://login.tailscale.com/a/abc123def456Copy this URL and open it in your browser. Log in with the Tailscale account you just created. Authorize the VPS when prompted.
Back in your SSH session, check the Tailscale IP:
bash
tailscale ip -4You’ll see something like:
100.101.102.103Save this IP. This is your VPS’s private Tailscale address. You’ll use it for all future connections.
Step 11: Install Tailscale on Your Laptop
Your VPS is on Tailscale, but it’s alone. You need your laptop on the same network so the two can talk privately.
macOS: Download Tailscale from the Mac App Store (search “Tailscale”) or go to tailscale.com/download/macos. After installing:
Open Tailscale from Applications
macOS will ask you to allow the system extension in System Settings > Privacy & Security - click Allow
Click “Log in” in the Tailscale menu bar icon
Sign in with the same account you used for the VPS
Windows: Download from tailscale.com/download/windows and run the installer. Sign in with the same account.
Linux: Run the same install command as the VPS in Step 10: curl -fsSL https://tailscale.com/install.sh | sh then tailscale up.
After your laptop connects, go to the Tailscale admin console (login.tailscale.com/admin/machines). You should see both devices listed with green “Connected” status:
Your VPS (e.g.,
100.101.102.103)Your laptop (e.g.,
100.104.105.106)
Test the private connection from your laptop:
bash
ssh root@100.101.102.103Replace with your VPS’s Tailscale IP. If this works, your devices can communicate over the encrypted Tailscale network. This is the connection you’ll use for everything from now on.
Step 12: Configure UFW for Tailscale
Back on the VPS, allow traffic from the Tailscale subnet:
bash
ufw allow from 100.64.0.0/10Verify:
bash
ufw statusYou should see:
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
Anywhere ALLOW 100.64.0.0/10What this does:
Devices on your Tailscale network can now reach any port on the VPS. Public internet traffic is still blocked except SSH (which we keep for now as a fallback). This is the foundation of zero-trust access.
Step 13: Install Docker
Install Docker and Docker Compose:
bash
curl -fsSL https://get.docker.com | shThis takes 2-3 minutes.
Start Docker:
bash
systemctl enable docker
systemctl start dockerVerify:
bash
docker --versionYou should see:
Docker version 29.x.x, build xxxxxxxStep 14: Verify Docker Compose
Modern Docker installs include Docker Compose. Verify:
bash
docker compose versionYou should see:
Docker Compose version v5.x.xYou’re 45 minutes in. Tailscale is running, Docker is installed, and your firewall allows Tailscale traffic. Phase 4 installs OpenClaw.
This guide is honest about timing: 90 minutes if everything goes right, up to 2 hours if this is your first server setup. Most people hit at least one snag per phase, and a single misconfigured UFW rule or Tailscale authorization hiccup can eat another 45 minutes.
PluggedIn members get the OpenClaw Autopilot pack with 12 Claude Code commands and pre-built scripts that handle the error-prone parts automatically.
Phase 4: OpenClaw Installation using Docker (30 Minutes)
OpenClaw offers a one-liner installer
curl -fsSL https://openclaw.ai/install.sh | bash
But we’re using Docker instead for our OpenClaw installation and setup.
Why Docker for OpenClaw?
Docker gives us resource limits (memory/CPU caps), clean isolation from the host OS, and easy rollback if an update breaks something. For a security-first setup, that control matters.
OpenClaw’s Docker setup uses two services:
openclaw-gateway - the main server (ports 18789 + 18790)
openclaw-cli - command-line tool for configuration and channel management
Step 15: Clone the Docker Setup
On your VPS, clone the community Docker setup repo:
bash
cd /opt
git clone https://github.com/ozbillwang/openclaw-in-docker.git openclaw
cd openclawStep 16: Pull the Image
bash
export OPENCLAW_IMAGE="alpine/openclaw:latest"
docker pull alpine/openclaw:latestThis downloads about 500MB. Takes 1-2 minutes depending on your connection.
Hardening tip (from ToxSec’s Security Checklist): If you’re comfortable editing Docker Compose files, add
:ro(read-only) flags to any bind mounts that OpenClaw doesn’t need to write to. For example, if you mount reference files or templates into the container, use/path/on/host:/path/in/container:ro. The main config directory (/root/.openclaw) needs read-write access, but anything else should be read-only by default. This prevents a compromised agent from modifying files outside its workspace.
Step 17: Fix Permissions and Run the Setup Wizard
The OpenClaw container runs as a non-root user (UID 1000). Create the config directory and set the right ownership before running setup:
bash
mkdir -p /root/.openclaw
chown -R 1000:1000 /root/.openclawNow run the setup script:
bash
./docker-setup.shThe script auto-generates a gateway token and prints it at the top:
==> Onboarding (interactive)
When prompted:
- Gateway bind: lan
- Gateway auth: token
- Gateway token: dd3ffa2d... <-- SAVE THIS TOKENCopy that token now. You’ll need it every time you open the dashboard.
The interactive wizard walks you through these screens:
Security warning - Read it, select Yes to continue
Onboarding mode - Select QuickStart (configures sensible defaults)
Model/auth provider - Select your AI provider (OpenRouter gives access to multiple models through one API key). Paste your API key when prompted.
Default model - Keep current (openrouter/auto) is fine to start. You can change it later.
Select channel - Select Telegram (Bot API) (recommended, newcomer-friendly). Paste the bot token from Step 2 when prompted.
Web search provider - Select Skip for now. You can add this later if you want your agent to search the web.
Configure skills? - Select No. Skills (tools the agent can use) can be configured later through the dashboard.
Enable hooks? - Select Skip for now. Hooks automate actions on agent commands - an advanced feature for later.
After the wizard completes, it starts the gateway automatically:
==> Starting gateway
Gateway running with host port mapping.
Config: /root/.openclaw
Token: [YOUR-GENERATED-TOKEN]Step 18: Fix the Control UI Origin Setting
The Docker setup binds the gateway to lan mode (all interfaces) so Docker port mapping works. But the Control UI requires explicit allowed origins when running in non-loopback mode.
Without this fix, the gateway will crash-loop with “non-loopback Control UI requires gateway.controlUi.allowedOrigins.”
Run this command to patch the config (single line, paste as-is):
bash
python3 -c "import json; f='/root/.openclaw/openclaw.json'; c=json.load(open(f)); c['gateway']['controlUi']={'allowedOrigins':['http://localhost:18789','http://127.0.0.1:18789'],'dangerouslyAllowHostHeaderOriginFallback':True}; json.dump(c,open(f,'w'),indent=2); print('Done')"Then restart the gateway to pick up the change:
bash
docker compose restartThe dangerouslyAllowHostHeaderOriginFallback flag sounds scary but is safe here. Your gateway is behind Tailscale with no public ports. The “danger” only applies to internet-exposed setups.
Defense-in-depth note: Our Docker setup binds the gateway to
lanmode (all interfaces) so Docker port mapping works correctly. ToxSec’s checklist (referenced below) recommends binding to127.0.0.1(localhost only) as the gold standard.In our setup, the combination of UFW deny-by-default + Tailscale-only access achieves the same protection - no public traffic can reach the gateway even though it binds to all interfaces.
If you want the extra layer, you can modify the Docker Compose to use
127.0.0.1:18789:18789instead of18789:18789in the ports section, but you’ll need Tailscale Serve or SSH tunneling for access (which we already use).
Step 19: Verify OpenClaw is Running
Check the logs:
bash
docker compose logs -f openclaw-gatewayYou should see the gateway start without errors - look for lines like:
[gateway] listening on 0.0.0.0:18789
[bridge] listening on 0.0.0.0:18790If you still see “Gateway failed to start” errors, double-check that the controlUi section was added inside the gateway object in /root/.openclaw/openclaw.json.
Press Ctrl+C to stop following logs.
Step 20: Access the Dashboard via Tailscale
Your laptop already has Tailscale from Step 11. Open a terminal on your laptop (not the VPS) and create an SSH tunnel:
bash
ssh -L 18789:127.0.0.1:18789 -L 18790:127.0.0.1:18790 root@100.101.102.103Replace 100.101.102.103 with your VPS’s Tailscale IP from Step 10.
Open your browser and go to (replace with your actual token from the wizard output in Step 17):
http://localhost:18789/#token=YOUR-GATEWAY-TOKEN-HEREThe dashboard loads but shows “pairing required” - this is a security feature. Your browser needs to be approved as a trusted device before it can control the gateway.
Go to the Overview page in the dashboard. You’ll see the Gateway Token field is pre-filled. Click Connect.
Now switch to your VPS terminal and approve the pairing request:
bash
cd /opt/openclaw
docker compose exec openclaw-gateway node dist/index.js devices list --token "$(grep OPENCLAW_GATEWAY_TOKEN .env | cut -d= -f2)"You’ll see a Pending request with a Request ID. Approve it:
bash
docker compose exec openclaw-gateway node dist/index.js devices approve REQUEST-ID-HERE --token "$(grep OPENCLAW_GATEWAY_TOKEN .env | cut -d= -f2)"Replace REQUEST-ID-HERE with the actual ID from the list command (looks like 08a56d39-3745-...).
Go back to your browser and click Refresh or reload the page. The dashboard should now show:
Status: OK (green)
Health OK in the top-right corner
Your gateway version and uptime
What just happened:
Your laptop connected to the VPS via Tailscale (encrypted tunnel)
SSH forwarded ports 18789 and 18790 from the VPS to your laptop
The browser connects to localhost, which tunnels through SSH to the VPS
Device pairing ensures only approved browsers can control the gateway
Zero public exposure. The gateway is only accessible via this tunnel
Count the security layers you just built for your OpenClaw setup:
UFW firewall - blocks all public ports except SSH
Tailscale VPN - your VPS is only reachable from your private network (100.x.x.x)
SSH tunnel - the dashboard is tunneled through an encrypted SSH connection, not exposed directly
Gateway token - even if someone reaches port 18789, they need the token to authenticate
Device pairing - even with the token, new devices need explicit approval from the VPS
That’s five layers between the internet and your AI agent. Most OpenClaw setups have zero. For an even deeper security audit, ToxSec’s OpenClaw Security Checklist covers enterprise-grade hardening like secrets vaulting, rate limiting, and audit logging. We cover the solopreneur-essential subset in Article 4 of this series.
OpenClaw also supports Tailscale Serve as an alternative to SSH tunnels (direct access via your tailnet without keeping a tunnel open), but our SSH approach is simpler and equally secure.
You’re 75 minutes in. OpenClaw is running and accessible. Phase 5 connects your first channel.
Phase 5: Verify + First Message OpenClaw Agent (15 Minutes)
The OpenClaw setup wizard configured a default AI agent and connected your Telegram bot. Now you’ll pair your Telegram account , explore the dashboard, and verify the agent responds. Custom agents with specific tasks (email triage, content research) come in the next article.
Step 21: Verify Telegram is Connected
The setup wizard already connected your Telegram bot (Screen 5). You can verify it’s active in two ways:
From the dashboard: Open the dashboard at http://localhost:18789 (via your SSH tunnel from Step 20) and check the Channels section. Your Telegram bot should appear as connected.
From the CLI (run on your VPS):
bash
cd /opt/openclaw
docker compose exec openclaw-gateway node dist/index.js channels list --token "$(grep OPENCLAW_GATEWAY_TOKEN .env | cut -d= -f2)"You should see your Telegram bot listed as active.
Step 22: Explore the Dashboard
The Control UI gives you access to:
Settings - API keys, model selection, gateway configuration
Channels - Connected messaging platforms (your Telegram bot should appear here)
Agents - Agent behavior and personality configuration
Check your agent’s core files: go to Agents > main > Files. You’ll see the agent’s workspace with files like AGENTS.md, SOUL.md, TOOLS.md, IDENTITY.md, USER.md, HEARTBEAT.md, and BOOTSTRAP.md.
If MEMORY.md is missing, click it to create one and add a short placeholder like # MEMORY.md - Hello, World, then click Save. The agent uses this file to persist context across conversations.
If you want to use a different model (like DeepSeek for lower costs), add your API key in Settings and change the model selection.
Step 23: Pair Your Telegram Account
Open Telegram and send /start to your bot. It replies with:
OpenClaw: access not configured.
Your Telegram user id: YOUR-TELEGRAM-USER-ID
Pairing code: ABC12345This is another security layer - your Telegram account needs approval before it can control the agent. On your VPS, approve the pairing:
bash
cd /opt/openclaw
docker compose exec openclaw-gateway node dist/index.js pairing approve telegram YOUR-PAIRING-CODEReplace YOUR-PAIRING-CODE with the code from the Telegram message (like ABC12345).
Step 24: Send a Test Message
Back in Telegram, send your bot a message:
Hello, what can you do?The agent should respond within 30 seconds. If it does, your setup is complete - you have a working AI agent accessible via Telegram, running on your own server.
You’re done. 90 minutes total. You have a working AI agent running 24/7 on Hetzner, accessible only via Tailscale, with zero public ports.
Expected Output: What Success Looks Like
Here’s what you should have after 90 minutes:
Hetzner VPS:
CX23 instance running Ubuntu 24.04
UFW firewall active (deny by default)
SSH key authentication only
Tailscale connected (100.x.x.x IP)
Docker running OpenClaw container
OpenClaw Gateway:
Accessible at
http://localhost:18789(via SSH tunnel)Gateway authenticated with token
Telegram bot connected as channel
First Agent Response:
Telegram message to your bot
Default agent responds within 30 seconds
You can chat, ask questions, and give basic tasks
Monthly Cost:
Hetzner VPS: ~$5
API usage: varies by model choice (OpenRouter gives access to dozens of models through one key)
Tailscale: $0 (free tier)
Total: ~$5/month base + API usage
What comes next (next article):
Custom agents with specific tasks (email triage, research, calendar)
Cost optimization: choosing the right model per task
SOUL.md configuration for agent behavior and safety boundaries
Troubleshooting: When Things Don’t Work
Issue 1: Can’t SSH into VPS
Symptom: Permission denied (publickey)
Fix:
Check you’re using the correct IP:
ssh root@203.0.113.42Verify your SSH key is in the right location:
ls ~/.ssh/id_ed25519Check Hetzner added your public key during VPS creation
Try specifying the key explicitly:
ssh -i ~/.ssh/id_ed25519 root@203.0.113.42
Issue 2: OpenClaw Dashboard Won’t Load
Symptom: Browser shows “Connection refused” at http://localhost:18789
Fix:
Check the SSH tunnel is active:
ps aux | grep sshVerify OpenClaw is running:
docker compose ps(on VPS, in/opt/openclaw)Check the logs:
docker compose logs -f openclaw-gateway(on VPS)Restart the gateway:
docker compose restart openclaw-gateway(on VPS)Recreate the SSH tunnel with the correct Tailscale IP
Issue 3: Agent Doesn’t Respond in Telegram
Symptom: You message your bot but get no response
Fix:
Check if your Telegram account is paired: did you complete Step 23? If you see “access not configured,” you need to approve the pairing code.
Verify Telegram channel is running: In the dashboard, go to Channels and check that Telegram shows “Running: Yes”
Check gateway logs:
docker compose logs --tail=20 openclaw-gateway(on VPS, in/opt/openclaw)Restart the gateway:
docker compose restart(on VPS, in/opt/openclaw)If the bot still doesn’t respond, check your API provider (OpenRouter) has credit and the API key is valid
Issue 4: Gateway Crash-Loops After Setup
Symptom: docker compose logs shows “Gateway failed to start: non-loopback Control UI requires gateway.controlUi.allowedOrigins”
Fix: This happens because the Docker setup uses lan binding mode. Run the config patch from Step 18:
bash
cd /opt/openclaw
python3 -c "import json; f='/root/.openclaw/openclaw.json'; c=json.load(open(f)); c['gateway']['controlUi']={'allowedOrigins':['http://localhost:18789','http://127.0.0.1:18789'],'dangerouslyAllowHostHeaderOriginFallback':True}; json.dump(c,open(f,'w'),indent=2); print('Done')"
docker compose restartWhy This Secure OpenClaw Setup Saves Time and Money
You just built a system that runs 24/7 for less than the cost of a Netflix subscription. Here’s what that means in practice:
Infrastructure Cost:
Hetzner CX23: ~$5/month (vs. $12-20/month on AWS/DigitalOcean)
Tailscale: $0 (free tier, up to 100 devices)
API costs: depends on your usage and model choice. You control this part (more in the next article.)
Base cost: ~$5/month before API usage
Security Comparison:
Public OpenClaw instance: 93.4% chance of auth bypass (based on Maor Dayan’s research)
This setup: 5 security layers, zero public ports, Tailscale-only access
Risk reduction: From “wide open” to “zero trust” (almost)
Scalability:
Add more channels via the dashboard or CLI
Configure agent behavior through SOUL.md files and the dashboard
Upgrade VPS: Hetzner CX33 ($7.49/month) if you need more resources
What You Can Build On This Foundation:
Custom agents for email triage, content research, calendar management
Multiple channels: Telegram, Discord, Slack, WhatsApp
Cost-optimized model routing: cheap models for simple tasks, powerful models for complex ones
All of this is covered in the next articles in this FREE OpenClaw Course
The 42,665 exposed instances taught us that security can’t be an afterthought. This setup delivers a solid, secure foundation. The fun part is building custom agents that actually save you hours and it comes next.
Frequently Asked Questions
How do I add more agents to my OpenClaw instance?
OpenClaw supports multiple channels and agent configurations through the dashboard and openclaw.json config file at ~/.openclaw/. Add new channels (Discord, Slack, WhatsApp) via the CLI: docker compose run --rm openclaw-cli channels add --channel discord --token YOUR_TOKEN.
Configure agent behavior through the dashboard Settings. Restart the gateway after config changes: docker compose restart openclaw-gateway.
What does OpenClaw cost compared to other AI agent platforms?
Hetzner VPS costs ~$5/month. API costs depend on your provider and usage - OpenRouter gives you access to dozens of models through one API key, so you can pick the right model for each task.
Compare the base infrastructure cost to Zapier ($20+/month), Make ($9+/month), or n8n Cloud ($24+/month). OpenClaw’s self-hosted approach means you only pay for actual API usage on top of the VPS. We’ll cover cost optimization strategies in the next articles of this OpenClaw course.
What’s the difference between OpenClaw and Claude Projects?
Claude Projects is a browser-based workspace for interactive AI assistance. OpenClaw is an autonomous agent platform that runs 24/7 without you. Use Claude Projects for research and writing. Use OpenClaw for automation that needs to happen while you sleep (email triage, scheduled tasks, webhook responses).
How do I control API costs of OpenClaw Agents?
OpenRouter gives you access to dozens of models through one API key, and you can restrict which models are available in your OpenRouter account settings. Costs depend entirely on which model you choose and how much you use it.
You can set a specific model in the OpenClaw dashboard or stick with the default. Strategies like using cheaper models (DeepSeek, Gemini Flash) for routine tasks and reserving powerful models (Claude, GPT-4) for complex work can keep costs under control.
We’ll cover detailed cost optimization with per-task model routing in the next articles.
Why does my agent still need confirmation for every action?
This is by design. OpenClaw’s default agent behavior includes safety boundaries. You can customize this through the dashboard settings and openclaw.json configuration. I recommend keeping confirmation prompts for irreversible actions like deleting emails or sending messages on your behalf.
How do I monitor OpenClaw’s API costs in real-time?
OpenClaw includes built-in health monitoring (you saw [health-monitor] started in the logs). For cost tracking, check the OpenClaw dashboard under Settings.
Set up a budget alert in your API provider’s account to email you if usage exceeds $20/month. DO NOT configure API provider account with Auto-Reload funds. This limits the cost damages at the cost of some proactive loading.
Can I run OpenClaw on a cheaper VPS than Hetzner CX23?
OpenClaw needs 2GB RAM minimum. Hetzner CX22 ($3.29/month, 2GB RAM) works but leaves no overhead for Docker. I tested this. Container restarts under load.
CX23 (4GB RAM) is the sweet spot. If you’re on a tight budget, use CX22 and monitor memory with docker stats. Upgrade to CX23 if you see OOM (out of memory) errors.
Key Takeaways
Security first, features second. Wire the alarm during construction (Tailscale, UFW, device pairing) before building agents. This prevents the 42,665 exposed instances problem.
Burner accounts are non-negotiable. Never connect AI agents to primary accounts. Create an email account and a dedicated Telegram bot for isolation.
Five security layers, not one. UFW firewall + Tailscale VPN + SSH tunnel + gateway token + device pairing. Most exposed instances have zero.
Hetzner CX23 is the cost-optimized choice. ~$4/month for 4GB RAM beats AWS ($12), DigitalOcean ($18), and Linode. You save $100-200/year without sacrificing performance.
The Docker setup wizard handles the complexity. The
docker-setup.shscript generates configs, tokens, and onboards you interactively. You don’t need to write YAML from scratch.This is infrastructure, not the finished product. You now have a secure, running OpenClaw instance. The real value - custom agents, cost-optimized model routing, automated workflows - comes in the next article.
Total setup time: 90 minutes. Broken into 5 phases with clear milestones. You’re not guessing. You’re following a tested path from VPS provisioning to first agent response.
Your 15-Minute Challenge
You’ve read the guide. Now build it.
Task: Set up the burner accounts and provision the Hetzner VPS (Phase 1 + first half of Phase 2).
Steps:
Create new email (5 minutes)
Create Telegram bot via @BotFather (3 minutes)
Provision Hetzner CX23 with SSH key (5 minutes)
SSH into VPS and run
apt update && apt upgrade -y(2 minutes)
Success criteria:
You can log into your new email account
You can message @openclaw_bot in Telegram (even though it’s not connected yet)
You can SSH into your Hetzner VPS with
ssh root@[your-vps-ip]System packages are updated
Why this matters:
These first 15 minutes prove you can do this. You’ve created the foundation. The rest is just following commands. If you get stuck, the troubleshooting section has fixes for common SSH issues.
Once you complete this challenge, Phase 2-5 take about 75 minutes. You’ll have a working AI agent by the end of the session.
Skip the Setup Grind: OpenClaw Autopilot
Everything in this guide is free and complete. You can follow every step manually and have a working setup in 90 minutes.
But if you’d rather skip the copy-paste and get pre-built automation, I put together the OpenClaw Autopilot pack:
12 Claude Code commands - Type
/setupand follow the prompts. The orchestrator guides you through everything: account creation, server provisioning, firewall, Tailscale, Docker, device pairing, and Telegram pairing. No prior server experience needed.3 agent templates - Content Creator, Research Assistant, and Email Manager SOUL.md files. Ready to deploy. Each one has safety boundaries already configured.
Infrastructure scripts - One-shot server setup (
setup-server.sh), health monitoring (health-check.shwith JSON output for automation), and timestamped backups with retention.Dual platform configs - Docker Compose files optimized for Hetzner CX23 (~$5/month) and Oracle Cloud Free Tier ($0/month, ARM64).
What’s Next
You have a secure OpenClaw instance running 24/7 on Hetzner with a default agent responding to Telegram. That’s the foundation. Now comes the part that actually saves you time.
In the next article, we’ll build custom agents on top of this infrastructure:
Cost optimization - choosing the right model for each task (cheap models for routine work, powerful models for complex research)
Custom SOUL.md files - defining agent personality, safety boundaries, and task-specific behavior
Practical workflows - email triage, content research, and calendar management agents
Multi-agent patterns - running specialized agents that each handle one job well
Your infrastructure is solid. Your security is tight. Next step: put it to work.
This is Article #2 in the OpenClaw for Solopreneurs series. If you missed it, start with What OpenClaw Actually Is (And Isn’t).
Unplugged Reads
Handpicked from creators I actually read.
ToxSec published The OpenClaw Security Checklist - a comprehensive pre-launch audit covering everything from network exposure to secrets management. This guide covers the solopreneur essentials. For the full enterprise-grade checklist, read his article.
Get PluggedIn
Stop debugging firewall rules line by line and let the orchestrator handle the entire 5-phase setup for you.
Every stuck terminal session costs you 45 minutes you were not planning to spend.
Get PluggedIn to go from copy-pasting terminal commands and hoping nothing breaks to running /setup and having a secure, Tailscale-locked OpenClaw instance ready in one guided session
Your PluggedIn assets for this post
What’s inside:
setup-checklist.pdf - 90-Minute Setup Checklist with fill-in-the-blank fields (all 5 phases, 24 steps)
credentials-tracker.pdf - Credentials Tracker + Quick Commands Reference (every account, IP, and token in one place)
docker-compose.yml - Annotated Reference Docker Compose (understand what the wizard generates)
troubleshooting-prompt.pdf - AI Troubleshooting Prompt (paste your error, get the fix)
security-audit-prompt.pdf - Post-Setup Security Audit Prompt (verify all 5 layers are locked down)












Tailscale is the right call here. Exposing ports and managing firewall rules manually turns into a maintenance problem fast once you start adding services. One thing this setup trades away: you lose the Unified Memory advantage of Apple Silicon for inference.
On a Hetzner CX23, you're back to CPU inference or hitting external APIs. For anyone choosing between VPS and dedicated local hardware, the economics look very different depending on whether you're running local models or routing to Anthropic. VPS wins on reliability and isolation. Local wins on cost and inference speed. Did you run into any issues with Docker network bridging when Tailscale MagicDNS is active?
That caused some unexpected behavior on my end.
Hey, thanks for this amazing article, Dheeraj!
Is there any other use case for OpenClaw especially for content creators/writers? I ask this because most of the OpenClaw tutorials just shows how to run a telegram/whatsapp bot? I wonder what else can we explore safely/securely with this?