OpenClaw常见问题及命令

OpenClaw常见问题与常用命令速查

启动引导

安装完成后,运行 Onboarding 完成初始配置。

openclaw onboard --install-daemon

Gateway 基础操作

# 查看 Gateway 状态
openclaw gateway status

# 在前台运行(适合调试)
openclaw gateway --port 18789

# 详细日志模式
openclaw gateway --port 18789 --verbose

# 强制占用端口并启动(解决端口冲突)
openclaw gateway --force

# 重启 Gateway
openclaw gateway restart

# 停止 Gateway
openclaw gateway stop

# 查看实时日志
openclaw logs --follow

终端聊天界面

openclaw tui

关键命令速查

命令 说明
openclaw doctor 全面健康检查并尝试修复配置问题
openclaw health 快速健康检查
openclaw status 查看 Gateway 和渠道整体状态
openclaw gateway status 查看 Gateway 进程状态
openclaw gateway status --deep 深度状态检查(包含 RPC 探针)
openclaw gateway run 前台运行 Gateway
openclaw gateway start 后台启动 Gateway 服务
openclaw gateway stop 停止 Gateway 服务
openclaw gateway restart 重启 Gateway 服务
openclaw gateway probe 检测 Gateway 连通性和状态
openclaw gateway discover 发现局域网或远程 Gateway
openclaw gateway call health 调用 Gateway 健康检查接口
openclaw channels status --probe 检查所有渠道连接状态
openclaw dashboard 打开浏览器控制面板
openclaw logs --follow 实时跟踪日志输出
openclaw onboard 重新运行初始化配置向导
openclaw secrets reload 热重载 Secrets 配置

局域网访问

{
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "lan",
    "controlUi": {
      "allowedOrigins": [
        "*",
        "http://<your_ip>:18789"
      ],
      "allowInsecureAuth": true,
      "dangerouslyDisableDeviceAuth": true
    }
  },
  "tailscale": {
    "mode": "off"
  }
}

gateway.controlUI说明

使用以下属性时,请务必注意使用环境安全

属性 说明
allowedOrigins 允许的跨源地址。 设置为 [ “*” ]可不限制
allowInsecureAuth 支持在非https或者localhost环境下,用token认证
dangerouslyDisableDeviceAuth 跳过设备认证

gateway.bind 说明

取值 监听地址 权限范围说明
loopback 127.0.0.1 仅本机,暴露面最小
lan 0.0.0.0 本机 + 局域网都可连
tailnet 机器 Tailscale IP 仅 Tailscale 网络
auto 有 tailnet 则 tailnet,否则 lan 自动选择
custom gateway.customBindHost 指定IP 手动指定单网卡

若设置为 lan ,务必配合 gateway.auth(token 或 password)和防火墙,避免未授权访问 若仅需在 Tailscale 内访问,可考虑 gateway.bind: "tailnet" 或保持 loopback + Tailscale Serve,减少对 LAN 的暴露。

非 loopback 必须配置认证

重要: 只要 bind 不是 loopback(例如设为 lan),OpenClaw 要求配置 gateway.auth(token 或 password),否则 Gateway 可能拒绝启动或 Control UI 显示未授权。

生成令牌: openclaw doctor --generate-gateway-token 将令牌写入 gateway.auth.token,或通过环境变量 OPENCLAW_GATEWAY_TOKEN 提供给 Gateway 进程(如 systemd 或 launchd 的环境配置)


默认仅能发送消息,无法执行命令

OpenClaw 2026.3.2 版本中,tools.profile 的默认值为 messaging 该取值仅开放消息相关权限,因此无法执行命令、操作文件系统等高级功能。想要解锁完全权限,只需调整 tools.profile的取值。

{
  "tools": {
    "profile": "full"
  },
}
取值 权限范围说明
minimal 仅开放会话状态(session_status)权限,功能最精简
coding 开放文件系统、运行时、会话、内存、图片相关权限(group:fs/group:runtime等)
messaging 仅开放消息相关权限(group:messaging/sessions_list/sessions_send等
full 无权限限制(等同于不设置该值),支持执行命令、发送消息等所有操作

配置支持浏览器和文件操作

# 把openclaw的权限提升 coding 或更高级别
openclaw config set tools.profile coding

# 确保浏览器功能开启
openclaw config set browser.enabled true

# 切换到系统 Chrome(这就是“系统默认 Chrome”的官方方式)
openclaw config set browser.defaultProfile "chrome"

# 清空 allowlist(让 coding profile 自动暴露正确文件工具,这是关键!)
openclaw config set tools.allow '[]' 

# 配置完成,重启openclaw gateway(必做)
openclaw gateway restart

启动引导

安装完成后,运行 Onboarding 完成初始配置。

openclaw onboard --install-daemon

Gateway 基础操作

# 查看 Gateway 状态
openclaw gateway status

# 在前台运行(适合调试)
openclaw gateway --port 18789

# 详细日志模式
openclaw gateway --port 18789 --verbose

# 强制占用端口并启动(解决端口冲突)
openclaw gateway --force

# 重启 Gateway
openclaw gateway restart

# 停止 Gateway
openclaw gateway stop

# 查看实时日志
openclaw logs --follow

终端聊天界面

openclaw tui

关键命令速查

命令 说明
openclaw doctor 全面健康检查并尝试修复配置问题
openclaw health 快速健康检查
openclaw status 查看 Gateway 和渠道整体状态
openclaw gateway status 查看 Gateway 进程状态
openclaw gateway status --deep 深度状态检查(包含 RPC 探针)
openclaw gateway run 前台运行 Gateway
openclaw gateway start 后台启动 Gateway 服务
openclaw gateway stop 停止 Gateway 服务
openclaw gateway restart 重启 Gateway 服务
openclaw gateway probe 检测 Gateway 连通性和状态
openclaw gateway discover 发现局域网或远程 Gateway
openclaw gateway call health 调用 Gateway 健康检查接口
openclaw channels status --probe 检查所有渠道连接状态
openclaw dashboard 打开浏览器控制面板
openclaw logs --follow 实时跟踪日志输出
openclaw onboard 重新运行初始化配置向导
openclaw secrets reload 热重载 Secrets 配置

局域网访问

{
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "lan",
    "controlUi": {
      "allowedOrigins": [
        "*",
        "http://<your_ip>:18789"
      ],
      "allowInsecureAuth": true,
      "dangerouslyDisableDeviceAuth": true
    }
  },
  "tailscale": {
    "mode": "off"
  }
}

gateway.controlUI说明

使用以下属性时,请务必注意使用环境安全

属性 说明
allowedOrigins 允许的跨源地址。 设置为 [ “*” ]可不限制
allowInsecureAuth 支持在非https或者localhost环境下,用token认证
dangerouslyDisableDeviceAuth 跳过设备认证

gateway.bind 说明

取值 监听地址 权限范围说明
loopback 127.0.0.1 仅本机,暴露面最小
lan 0.0.0.0 本机 + 局域网都可连
tailnet 机器 Tailscale IP 仅 Tailscale 网络
auto 有 tailnet 则 tailnet,否则 lan 自动选择
custom gateway.customBindHost 指定IP 手动指定单网卡

若设置为 lan ,务必配合 gateway.auth(token 或 password)和防火墙,避免未授权访问 若仅需在 Tailscale 内访问,可考虑 gateway.bind: "tailnet" 或保持 loopback + Tailscale Serve,减少对 LAN 的暴露。

非 loopback 必须配置认证

重要: 只要 bind 不是 loopback(例如设为 lan),OpenClaw 要求配置 gateway.auth(token 或 password),否则 Gateway 可能拒绝启动或 Control UI 显示未授权。

生成令牌: openclaw doctor --generate-gateway-token 将令牌写入 gateway.auth.token,或通过环境变量 OPENCLAW_GATEWAY_TOKEN 提供给 Gateway 进程(如 systemd 或 launchd 的环境配置)


默认仅能发送消息,无法执行命令

OpenClaw 2026.3.2 版本中,tools.profile 的默认值为 messaging 该取值仅开放消息相关权限,因此无法执行命令、操作文件系统等高级功能。想要解锁完全权限,只需调整 tools.profile的取值。

{
  "tools": {
    "profile": "full"
  },
}
取值 权限范围说明
minimal 仅开放会话状态(session_status)权限,功能最精简
coding 开放文件系统、运行时、会话、内存、图片相关权限(group:fs/group:runtime等)
messaging 仅开放消息相关权限(group:messaging/sessions_list/sessions_send等
full 无权限限制(等同于不设置该值),支持执行命令、发送消息等所有操作

配置支持浏览器和文件操作

# 把openclaw的权限提升 coding 或更高级别
openclaw config set tools.profile coding

# 确保浏览器功能开启
openclaw config set browser.enabled true

# 切换到系统 Chrome(这就是“系统默认 Chrome”的官方方式)
openclaw config set browser.defaultProfile "chrome"

# 清空 allowlist(让 coding profile 自动暴露正确文件工具,这是关键!)
openclaw config set tools.allow '[]' 

# 配置完成,重启openclaw gateway(必做)
openclaw gateway restart

加载中...