Install
openclaw skills install openclaw-exec-permissionOpenClaw exec安全权限配置指南。用于配置tools.exec的security和ask参数,管理agent命令执行权限。触发词:exec权限、安全配置、提权、exec security、ask off、allowlist。
openclaw skills install openclaw-exec-permission在 openclaw.json 的 tools.exec 下:
security: 执行安全级别
"deny" — 禁止所有exec"allowlist" — 仅允许白名单命令(默认)"full" — 允许所有命令,无限制ask: 审批模式
"off" — 跳过审批直接执行"always" — 每次都需审批"on-miss" — 仅白名单外的命令需审批tools.exec.security 和 tools.exec.ask 无法通过 config.patch 或 gateway config.apply 修改,会报错:
gateway config.patch cannot change protected config paths: tools.exec.security
python3 -c "
import json
with open('/home/zzclaw/.openclaw/openclaw.json') as f:
c = json.load(f)
c['tools']['exec']['security'] = 'full'
c['tools']['exec']['ask'] = 'off'
with open('/home/zzclaw/.openclaw/openclaw.json', 'w') as f:
json.dump(c, f, indent=2, ensure_ascii=False)
print('done')
"
然后重启 gateway:
openclaw gateway restart
| 场景 | security | ask | 说明 |
|---|---|---|---|
| 生产环境(严格) | allowlist | on-miss | 白名单内放行,其余审批 |
| 开发环境(宽松) | full | off | 全部放行,无审批 |
| 信任的私有机器 | full | off | 同上 |
| 多人共享 | allowlist | on-miss | 安全第一 |
security 为 allowlist 时,可通过 tools.exec.allowlist 配置允许的命令模式:
{
"tools": {
"exec": {
"security": "allowlist",
"allowlist": [
"git *",
"npm *",
"python3 *",
"cat *",
"ls *",
"echo *"
]
}
}
}
security 和 ask 只能手动改文件,无法通过 API 修改security=allowlist 时,未在白名单的命令会被拒绝,即使 ask=off 也不行