1. VPS setup (Hetzner, same process for any provider)
Start here first
We want to setup VPS server for our agents because otherwise our servers can be pinged, DDoSed, and brute-forced passwords from public internet.
First, we will go through all steps manually to create a VPS on Hetzner, then I will share the automation scripts to setup everything at once.
Although, we are running things on Hetzner, I will also provide you setup scripts for DigitalOcean and Mac Mini later.
Log in to your Hetzner account.
Create a new Project -> Create New Resource (Server)
Here's your project dashboard
Now you can create and configure your server
Type: start with Shared vCPU and upgrade to dedicated later. Recommended: CX23 or larger.
Location: pick the region closest to you, your services to be integrated (e.g., database) or your customers
Image: Ubuntu 24.04. Some people recommend Debian because it gets updated automatically.
Networking: enable both IPv4 and IPv6.
Add SSH keys
$ ssh-keygen -t rsa -b 4096 # press <Enter> for defaults
$ cat ~/.ssh/id_rsa.pub # copy to clipboard
Paste the key in the Hetzner dialog.
Leave Volumes and Firewalls empty for now.
Assign a server name and click Create and buy.
When the server turns green, copy its public IP.
SSH for the first time
$ ssh root@<PUBLIC_IP>
# type "yes" when prompted
You're in! Let's harden the security next.
2. Initial Security Hardening
Lock down before expanding capabilities
Update the system
$$ sudo apt update -y && sudo apt upgrade -y
Install Tailscale and connect devices
Next, we will install Tailscale, which is private network connection between authorized devices, which means local device and VPS.
curl -fsSL https://tailscale.com/install.sh | sh
Start the tailscale
sudo tailscale up --ssh
To authenticate, login to provided link in your browser.
Connect your server to Tailscale network
Complete the onboarding
Install Tailscale to your local machine where you want to access your VPS from
Pick your operating system
Sign in to your network from your local device
Once all devices are connected, you can ping one device from another.
You can now ping your local device from VPS
You should see the transmitted packages
Now try pinging your VPS from your local device
When you login to Tailscale in your browser, you can see all the devices connected to your Tailscale network.
In this case, it's my local computer and VPS that I created.
Great. Now we will harden VPS security by modifying a few fields in SSH config
In your VPS terminal, open the ssh config file.
nano /etc/ssh/sshd_config
This opens the editor to change options so this server will only listen on Tailscale network. Uncomment ListenAddress and paste the Hetzner server Tailscale IP from Tailscale admin console.
Other two settings are:
PasswordAuthentication no
PermitRootLogin no
Save with Ctrl + S and exit with Ctrl + X.
Create and verify non-root user
adduser clawuser
Enter password and accept default values.
usermod -aG sudo clawuser
su - clawuser
sudo whoami
Use this to check the new user has sudo access.
Restart SSH and verify access flow
logout
systemctl restart ssh
logout
Now root SSH should fail, which is expected. SSH as clawuser using Tailscale IP, with Tailscale running locally:
ssh root@100.105.11.108
But you can ssh as a new user
ssh clawuser@100.105.11.108
If you want access from another device, connect that device to the same Tailscale network first.
You may still be able to ping public IP at this stage. We will deal with that later after OpenClaw install.
Premium module: Hardening audit pack
Unlock an operator-grade security checkpoint before installation.
3. Install and onboard OpenClaw
Manual onboarding with OpenAI auth
Navigate to https://openclaw.ai/, take the one-liner for macOS/Linux, and run on server:
curl -fsSL https://openclaw.ai/install.sh | bash
Once OpenClaw is installed, go through configuration.
Select manual onboarding mode, and select OpenAI auth method to use existing ChatGPT subscription to leverage Codex.
When you paste OAuth URL into browser, sign in, copy the returned redirect URL code, and paste back into OpenClaw configuration.
If you want to check Codex usage:
https://chatgpt.com/codex/settings/usage
If you use API keys, set spend limits on provider to cap maximum spend.
Proceed with the remaining options as shown below.
Upcoming sections are scheduled to be published during March.