openClaw 正确、安全的 ClawdBot 安装流程
openClaw
https://github.com/openclaw/openclaw
How to
on VPS safely: from fresh Ubuntu VPS → hardened private AI server in 30 min
如何安全 @openclaw 使用 VPS:从新 Ubuntu VPS → 30 分钟内连接到加固的私有 AI 服务器
1) Lock down SSH
1)锁定 SSH
→ Keys only, no passwords, no root login.
→ 只用密钥,不设密码,不登录 root 权限。
sudo nano /etc/ssh/sshd_config # Set explicitly: PasswordAuthentication no PermitRootLogin no sudo sshd -t && sudo systemctl reload ssh
Sudo Nano /etc/ssh/sshd_config
# 明确设定:
密码认证 否
允许 RootLogin 编号
sudo sshd -t && sudo systemctl reload ssh
2) Default-deny firewall
2)默认拒绝防火墙
→ Block everything incoming by default.
→ 默认屏蔽所有进来信息。
sudo apt install ufw -y sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw enable
sudo apt install UFW -y
Sudo UFW 默认拒绝接收
Sudo UFW 默认允许外发
sudo UFW 启用
3) Brute-force protection
3)暴力破解防护
→ Auto-ban IPs after failed login attempts.
→ 登录失败后自动封禁 IP。
sudo apt install fail2ban -y sudo systemctl enable --now fail2ban
4) Install Tailscale
4)安装尾秤
→ Your private VPN mesh network.
→ 你的私人 VPN 网状网络。
curl -fsSL https://tailscale.com/install.sh | sh sudo tailscale up
curl -fsSL https://tailscale.com/install.sh |嘘
Sudo Tailscale Up
5) SSH only via Tailscale
5) 仅通过 Tailscale 进行 SSH
→ No more public SSH exposure.
→ 不再公开暴露于 SSH。
# Verify Tailscale is working first! tailscale status sudo ufw allow from 100.64.0.0/10 to any port 22 proto tcp
# 先确认 Tailscale 是否正常工作!
尾鳞状态
SUDO UFW 允许从 100.64.0.0/10 到任意端口 22 Proto TCP
sudo ufw delete allow OpenSSH
sudo ufw 删除允许 OpenSSH
6) Web ports private too
6)网页端口也为私密
→ App only accessible from your devices.
→应用只能从你的设备上访问。
sudo ufw allow from 100.64.0.0/10 to any port 443 proto tcp sudo ufw allow from 100.64.0.0/10 to any port 80 proto tcp
Sudo UFW 允许从 100.64.0.0/10 到任何 443 端口 proto TCP
SUDO UFW 允许从 100.64.0.0/10 到任意 80 端口的 Proto TCP
7) Disable IPv6 (optional)
7)禁用 IPv6(可选)
→ Reduces attack surface if unused.
→ 如果未被使用,可以减少攻击面。
sudo sed -i 's/IPV6=yes/IPV6=no/' /etc/default/ufw echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf sudo sysctl -p && sudo ufw reload
sudo sed -i 's/IPV6=yes/IPV6=no/' /etc/default/ufw
回声“net.ipv6.conf.all.disable_ipv6 = 1” |sudo tee -a /etc/sysctl.conf
sudo sysctl -p && sudo UFW Reload
8) Clawdbot install
8)爪机器人安装
→ AI assistant on your private server.
→你的私人服务器上的 AI 助手。
npm install -g clawdbot && clawdbot doctor
NPM 安装 -G Clawdbot && Clawdbot Doctor
9) Lock Clawdbot to owner only
9)仅限所有者锁定爪机器人
→ Only you can message the bot.
→ 只有你能给机器人发消息。
{ "dmPolicy": "allowlist", "allowFrom": ["YOUR_TELEGRAM_ID"], "groupPolicy": "allowlist" }
{ “dmPolicy”: “允许列表”, “allowFrom”: [“YOUR_TELEGRAM_ID”], “groupPolicy”: “允许列表” }
10) Fix credential permissions
10)修复凭证权限
→ Don't leave secrets world-readable.
→ 不要让秘密被全世界都读懂。
chmod 700 ~/.clawdbot/credentials chmod 600 .env
11) Run security audit
11)进行安全审计
→ Catches issues you missed - don't skip!
→ 发现你错过的期刊——不要跳过!
clawdbot security audit --deep
Clawdbot 安全审计——深度
Verify everything:
核实所有内容:
sudo ufw status ss -tulnp tailscale status clawdbot doctor
Sudo UFW 身份
SS -图尔恩普
尾鳞状态
爪机器人医生
Result: No public SSH
No public web ports
Server only reachable via Tailscale
Bot responds only to you
Private AI server in 30 min
结果: 无公开 SSH
没有公开网页端口
服务器只能通过 Tailscale 访问
机器人只对你有反应
30 分钟后私
有 AI 服务器
NOW you can start playing, not before.
现在你就可以开始玩了,而不是之前。
You buckle your seatbelts before you step on the gas, hmkay?
踩油门前系好安全带,好吗?











