Run OpenClaw Gateway in a Daytona Cloud Sandbox

Learn how to run a persistent OpenClaw Gateway inside a Daytona cloud sandbox with SSH access and signed preview URLs. Ideal for developers who want an isolated Linux environment without managing a VPS.

Read this when

  • Running OpenClaw in a Daytona sandbox
  • You want a cloud sandbox for OpenClaw without managing a VPS

Run a persistent OpenClaw Gateway inside a Daytona cloud sandbox. This gives you an isolated Linux environment with SSH access and built-in preview URLs, and you never have to manage a VPS. OpenClaw is already installed in the daytona-medium snapshot, so you can start working as soon as you SSH in.

Bind the Gateway to loopback only, and use Daytona's signed preview URLs to reach the dashboard. Never expose the Gateway port directly to the public internet.

What you need

Install the Daytona CLI

macOS / Linux

brew install daytonaio/cli/daytona

Windows

powershell -Command "irm https://get.daytona.io/windows | iex"

Check that the installation worked:

daytona --version

Older CLI releases are missing newer sandbox commands, so update it regularly (for example brew upgrade daytonaio/cli/daytona).

Authenticate

daytona login --api-key=YOUR_API_KEY

Create a sandbox

daytona sandbox create --name openclaw --snapshot daytona-medium --auto-stop 0
FlagWhy
--snapshot daytona-mediumGives enough memory headroom for the Gateway to run
--auto-stop 0Leaves the sandbox active until you stop it manually

Connect via SSH

daytona ssh openclaw

Run onboarding

Once inside the sandbox, set up OpenClaw with a single command:

openclaw onboard --non-interactive --accept-risk \
  --anthropic-api-key YOUR_ANTHROPIC_KEY \
  --skip-daemon --skip-channels --skip-skills --skip-hooks --skip-health

--skip-daemon is important: Daytona sandboxes lack a service manager, so you will start the Gateway manually below. Swap the key flag for whatever provider you use (--openai-api-key, --openrouter-api-key, and so on); openclaw onboard --help has the full list. Channels, skills, and hooks are left out here and added later.

If you run openclaw onboard with no flags, it launches a conversational setup assistant that needs an interactive terminal; openclaw onboard --classic invokes the older step-by-step wizard.

Onboarding sets up a gateway auth token. You can print it from the sandbox at any time:

node -p "require(process.env.HOME + '/.openclaw/openclaw.json').gateway.auth.token"

openclaw config get gateway.auth.token gives you __OPENCLAW_REDACTED__ instead of the actual value, since the CLI hides secrets in its output.

Allow the preview URL origin

The Gateway only accepts browser connections from origins you allow, and Daytona's preview proxy sits in front of it. Set up both before you start the Gateway.

From your local terminal (not the sandbox SSH session), create a signed preview URL for the Gateway port:

daytona preview-url openclaw --port 18789

Copy the URL that appears. Back in the sandbox SSH session, permit that origin and trust the in-sandbox preview proxy, swapping in your own URL for the example:

openclaw config set gateway.controlUi.allowedOrigins '["PASTE_YOUR_PREVIEW_URL"]'
openclaw config set gateway.trustedProxies '["127.0.0.1"]'

Paste the URL exactly as it was printed: scheme and host only, with no trailing slash and no path. The Gateway compares the browser origin literally, and browsers send https://host without a trailing slash, so https://host/ will not match and the connection gets rejected. Browser address bars often show that trailing slash, so copy from the terminal instead.

Start the Gateway

nohup openclaw gateway run > /tmp/gateway.log 2>&1 &

The Gateway runs in the background and stays alive across SSH disconnects. Confirm it is running:

openclaw gateway health

That command reports the Gateway status, so OK means you are ready to move on.

To restart the Gateway later (after config changes or updates):

pkill -f "openclaw gateway" || true
nohup openclaw gateway run > /tmp/gateway.log 2>&1 &

Open the dashboard

Open the preview URL you generated earlier in your browser. The Control UI asks for the gateway token on first connect; paste the value you printed after onboarding.

Approve your device

The first browser connection queues a device pairing request. Back in your sandbox SSH session:

# List pending requests and copy the request id
openclaw devices list

# Approve it
openclaw devices approve REQUEST_ID

Security

Three layers protect access to the Gateway:

LayerDescription
Preview URLTime-limited signed URL (expires after 1 hour)
Gateway tokenRequired to connect via the Control UI
Device approvalEach new browser or client must be explicitly approved

Keep your gateway token and preview URLs private. The Gateway stays bound to loopback; Daytona's preview proxy handles external access.

Channel setup

Unknown senders require pairing approval by default; see Pairing.

Telegram

Create a bot with @BotFather (/newbot), copy the token, then configure OpenClaw from the sandbox SSH session:

export TELEGRAM_BOT_TOKEN="<bot-token>"
openclaw channels add --channel telegram --use-env

Also store TELEGRAM_BOT_TOKEN=<bot-token> in ~/.openclaw/.env so the background Gateway receives it after a restart. --use-env validates the token without copying it into openclaw.json.

Restart the Gateway (see above), send your bot a DM, then approve the pairing code it reports:

openclaw pairing list telegram
openclaw pairing approve telegram PAIRING_CODE

Pairing codes expire after 1 hour. Full reference: Telegram.

WhatsApp

WhatsApp ships as a separate plugin, so install and enable it first:

openclaw plugins install clawhub:@openclaw/whatsapp --acknowledge-clawhub-risk
openclaw plugins enable whatsapp

Installing does not enable a plugin, so the enable step is required; otherwise the Gateway reports the channel as configured but untrusted. Running the login command below without installing first prompts you to download the plugin from ClawHub or npm instead.

Then link the account by scanning a QR code from the sandbox SSH session:

openclaw channels login --channel whatsapp

On your phone: Settings → Linked Devices → Link a Device, then scan the QR code shown in the terminal. Restart the Gateway after linking, then message yourself on WhatsApp and OpenClaw replies in that chat.

No pairing approval is needed: with no allowlist configured, the linked account's own number is allowed by default. Pairing applies to unknown senders, which is why Telegram needs it and self-chat does not. Allowlists, personal-number mode, and self-chat details: WhatsApp.

Updating

Because the snapshot's global npm tree belongs to root, a standard openclaw update lacks write access to it. Run the update from the sandbox's SSH session:

This command targets npm 12 or npm 11.16 and later. For npm 11.15 or older, leave out --allow-scripts=openclaw.

sudo env "PATH=$PATH" npm install --global openclaw@latest --allow-scripts=openclaw
openclaw doctor

After the update, openclaw doctor handles migration of any older configuration. Then restart the Gateway as described earlier.

Stop and resume the sandbox

# Stop
daytona sandbox stop openclaw

# Resume
daytona sandbox start openclaw

While sandbox state carries over between stop and start cycles, the Gateway process won't launch on its own. Following a resume, re-establish the connection and start it manually:

daytona ssh openclaw
nohup openclaw gateway run > /tmp/gateway.log 2>&1 &

Troubleshooting

Gateway not running after sandbox restart

A sandbox restart kills the Gateway process. Reconnect using daytona ssh openclaw and relaunch it with the nohup command listed above.

Preview URL expired

Preview URLs expire after a set period (3600 seconds by default). From your local terminal, generate a fresh one, optionally extending the validity:

daytona preview-url openclaw --port 18789 --expires 86400

Every generated URL points to a distinct host, making it a separate origin. After regeneration, refresh gateway.controlUi.allowedOrigins with the new URL and restart the Gateway; otherwise, the Control UI gets rejected with origin not allowed.

Sandbox auto-stopped

If the sandbox was set up without --auto-stop 0, it shuts down on its own once idle. Bring it back with daytona sandbox start openclaw.

Gateway port not reachable

Verify that the Gateway is active and accepting connections:

openclaw gateway health
tail -20 /tmp/gateway.log

Should you alter the Gateway port, supply that same port to daytona preview-url.

Notes

1,347 words · updated Aug 25, 2026