元数据
| id | open-webui-forgot-password | 收录 | 2026-08-30 |
|---|---|---|---|
| 问题域 | 大模型本地部署 | 主题分组 | Agent 工具·运行与配置 |
| 适用工具 | docker · 外部工具open-webui | ||
症状
- 登录页提示 `The email or password provided is incorrect`,且想不起来密码。
- 注册接口报 403 `You do not have permission to access this resource`。
- 按旧教程找 `user.password_hash`,sqlite 报 `no such column: password_hash`。
原因
- 密码为本地 SQLite 中 bcrypt 哈希,无找回流程;新版拆到 `auth` 表(无 `password_hash` 列);默认禁止注册(`ENABLE_SIGNUP=false`),无法用新账号接管。
解法
- 备份 `webui.db` → 容器内 python3(自带 bcrypt/sqlite3)生成新哈希 → `UPDATE auth SET password=? WHERE email=?`(旧版改 `user.password_hash`)→ 直接新密码登录,无需重启。
验证证据
- 实测容器 `owui-pw`(`ghcr.nju.edu.cn/open-webui/open-webui:main`,2026-08-25 构建,端口 3002):
- 错误密码登录 → HTTP 400 `The email or password provided is incorrect`;
- 容器内 `bcrypt.hashpw(..., gensalt(rounds=12))` 生成 `$2b$12$` 哈希(bcrypt 5.0.0);
- `UPDATE auth SET password=? WHERE email=?` → `rows updated: 1`(app 运行中直改,无需停服);
- 改后错误密码 → 仍 400;新密码 → HTTP 200 返回 `role: admin` + JWT;
- 新 token 调 `GET /api/v1/auths/` → HTTP 200(会话真实有效);
- `bcrypt.checkpw(新密码, 库中哈希) = True`,`checkpw(错误密码) = False`;
- 测试容器与数据卷已清理(`docker rm -f` + `docker volume rm`)。
- 完整日志:`实测复现日志(2026-08-30)`
来源与证据
素材来源:本地容器实测(ghcr.nju.edu.cn/open-webui/open-webui:main,2026-08-25 构建)
验证证据:Evidence details kept locally (2026-08-30)