安装完成后设置管理员账号报错,请问如何解决 #20615

Closed
opened 2026-02-21 20:08:10 -05:00 by yindo · 7 comments
Owner

Originally created by @yvway on GitHub (Nov 27, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

v1.10.1

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Setup failed: PermissionDenied (persistent) at write => permission denied Context: service: fs path: privkeys/a4a232ae-b83d-4394-ba38-b5198c2a38b3/private.pem Source: Permission denied (os error 13)

✔️ Expected Behavior

成功设置管理员账号

Actual Behavior

No response

Originally created by @yvway on GitHub (Nov 27, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version v1.10.1 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce Setup failed: PermissionDenied (persistent) at write => permission denied Context: service: fs path: privkeys/a4a232ae-b83d-4394-ba38-b5198c2a38b3/private.pem Source: Permission denied (os error 13) ### ✔️ Expected Behavior 成功设置管理员账号 ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 20:08:10 -05:00
yindo closed this issue 2026-02-21 20:08:10 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 27, 2025):

这个问题是因为 Dify 在设置管理员账号时,需要在 privkeys/{tenant_id}/private.pem 路径下写入私钥文件,但当前运行 Dify 的进程没有该目录的写入权限,导致报错(os error 13)相关代码分析

你可以按照以下步骤排查和解决:

  1. 确认 Dify 进程用户
    ps aux | grep dify 或查看你的服务/容器配置,确认 Dify 是用哪个用户运行的。

  2. 检查目录权限
    在 Dify 项目根目录下执行:

    ls -ld privkeys
    ls -ld privkeys/*
    

    检查 privkeys 及其子目录的拥有者和权限。

  3. 修复权限
    假设 Dify 用 difyuser 运行,可以用以下命令修复:

    sudo chown -R difyuser:difyuser privkeys
    sudo chmod -R 700 privkeys
    

    如果你用的是 Docker,确保挂载的宿主机目录也有正确权限。

  4. SELinux/AppArmor
    如果你的系统启用了 SELinux 或 AppArmor,可能还需要放宽策略,允许 Dify 写入该目录。

  5. 重试设置管理员账号
    权限修复后,重新运行设置流程。

只要保证 Dify 进程用户对 privkeys 目录有写权限,问题一般可以解决。如果还有问题,可以贴一下你的权限检查结果和运行环境细节。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 27, 2025): <!-- Answer --> 这个问题是因为 Dify 在设置管理员账号时,需要在 `privkeys/{tenant_id}/private.pem` 路径下写入私钥文件,但当前运行 Dify 的进程没有该目录的写入权限,导致报错(os error 13)[相关代码分析](https://github.com/langgenius/dify/blob/dc9b3a7e034c348f437f5350543be8319591d29a/api/libs/rsa.py#L13-L24)。 你可以按照以下步骤排查和解决: 1. **确认 Dify 进程用户** 用 `ps aux | grep dify` 或查看你的服务/容器配置,确认 Dify 是用哪个用户运行的。 2. **检查目录权限** 在 Dify 项目根目录下执行: ```bash ls -ld privkeys ls -ld privkeys/* ``` 检查 `privkeys` 及其子目录的拥有者和权限。 3. **修复权限** 假设 Dify 用 `difyuser` 运行,可以用以下命令修复: ```bash sudo chown -R difyuser:difyuser privkeys sudo chmod -R 700 privkeys ``` 如果你用的是 Docker,确保挂载的宿主机目录也有正确权限。 4. **SELinux/AppArmor** 如果你的系统启用了 SELinux 或 AppArmor,可能还需要放宽策略,允许 Dify 写入该目录。 5. **重试设置管理员账号** 权限修复后,重新运行设置流程。 只要保证 Dify 进程用户对 `privkeys` 目录有写权限,问题一般可以解决。如果还有问题,可以贴一下你的权限检查结果和运行环境细节。 <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/b45cdabe-503e-48ea-b173-28ead1b632d2?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b45cdabe-503e-48ea-b173-28ead1b632d2?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b45cdabe-503e-48ea-b173-28ead1b632d2?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b45cdabe-503e-48ea-b173-28ead1b632d2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b45cdabe-503e-48ea-b173-28ead1b632d2?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b45cdabe-503e-48ea-b173-28ead1b632d2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b45cdabe-503e-48ea-b173-28ead1b632d2?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=%E8%BF%99%E4%B8%AA%E9%97%AE%E9%A2%98%E6%98%AF%E5%9B%A0%E4%B8%BA%20Dify%20%E5%9C%A8%E8%AE%BE%E7%BD%AE%E7%AE%A1%E7%90%86%E5%91%98%E8%B4%A6%E5%8F%B7%E6%97%B6%EF%BC%8C%E9%9C%80%E8%A6%81%E5%9C%A8%20%60privkeys/%7Btenant_id%7D/private.pem%60%20%E8%B7%AF%E5%BE%84%E4%B8%8B%E5%86%99%E5%85%A5%E7%A7%81%E9%92%A5%E6%96%87%E4%BB%B6%EF%BC%8C%E4%BD%86%E5%BD%93%E5%89%8D%E8%BF%90%E8%A1%8C%20Dify%20%E7%9A%84%E8%BF%9B%E7%A8%8B%E6%B2%A1%E6%9C%89%E8%AF%A5%E7%9B%AE%E5%BD%95%E7%9A%84%E5%86%99%E5%85%A5%E6%9D%83%E9%99%90%EF%BC%8C%E5%AF%BC%E8%87%B4%E6%8A%A5%E9%94%99%EF%BC%88os%20error%2013%EF%BC%89%5B%E7%9B%B8%E5%85%B3%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%90%5D%28https%3A//github.com/langgenius/dify/blob/dc9b3a7e034c348f437f5350543be8319591d29a/api/libs/rsa.py%23L13-L24%29%E3%80%82%0A%0A%E4%BD%A0%E5%8F%AF%E4%BB%A5%E6%8C%89%E7%85%A7%E4%BB%A5%E4%B8%8B%E6%AD%A5%E9%AA%A4%E6%8E%92%E6%9F%A5%E5%92%8C%E8%A7%A3%E5%86%B3%EF%BC%9A%0A%0A1.%20%2A%2A%E7%A1%AE%E8%AE%A4%20Dify%20%E8%BF%9B%E7%A8%8B%E7%94%A8%E6%88%B7%2A%2A%20%20%0A%20%20%20%E7%94%A8%20%60ps%20aux%20%7C%20grep%20dify%60%20%E6%88%96%E6%9F%A5%E7%9C%8B%E4%BD%A0%E7%9A%84%E6%9C%8D%E5%8A%A1/%E5%AE%B9%E5%99%A8%E9%85%8D%E7%BD%AE%EF%BC%8C%E7%A1%AE%E8%AE%A4%20Dify%20%E6%98%AF%E7%94%A8%E5%93%AA%E4%B8%AA%E7%94%A8%E6%88%B7%E8%BF%90%E8%A1%8C%E7%9A%84%E3%80%82%0A%0A2.%20%2A%2A%E6%A3%80%E6%9F%A5%E7%9B%AE%E5%BD%95%E6%9D%83%E9%99%90%2A%2A%20%20%0A%20%20%20%E5%9C%A8%20Dify%20%E9%A1%B9%E7%9B%AE%E6%A0%B9%E7%9B%AE%E5%BD%95%E4%B8%8B%E6%89%A7%E8%A1%8C%EF%BC%9A%0A%20%20%20%60%60%60bash%0A%20%20%20ls%20-ld%20privkeys%0A%20%20%20ls%20-ld%20privkeys/%2A%0A%20%20%20%60%60%60%0A%20%20%20%E6%A3%80%E6%9F%A5%20%60privkeys%60%20%E5%8F%8A%E5%85%B6%E5%AD%90%E7%9B%AE%E5%BD%95%E7%9A%84%E6%8B%A5%E6%9C%89%E8%80%85%E5%92%8C%E6%9D%83%E9%99%90%E3%80%82%0A%0A3.%20%2A%2A%E4%BF%AE%E5%A4%8D%E6%9D%83%E9%99%90%2A%2A%20%20%0A%20%20%20%E5%81%87%E8%AE%BE%20Dify%20%E7%94%A8%20%60difyuser%60%20%E8%BF%90%E8%A1%8C%EF%BC%8C%E5%8F%AF%E4%BB%A5%E7%94%A8%E4%BB%A5%E4%B8%8B%E5%91%BD%E4%BB%A4%E4%BF%AE%E5%A4%8D%EF%BC%9A%0A%20%20%20%60%60%60bash%0A%20%20%20sudo%20chown%20-R%20difyuser%3Adifyuser%20privkeys%0A%20%20%20sudo%20chmod%20-R%20700%20privkeys%0A%20%20%20%60%60%60%0A%20%20%20%E5%A6%82%E6%9E%9C%E4%BD%A0%E7%94%A8%E7%9A%84%E6%98%AF%20Docker%EF%BC%8C%E7%A1%AE%E4%BF%9D%E6%8C%82%E8%BD%BD%E7%9A%84%E5%AE%BF%E4%B8%BB%E6%9C%BA%E7%9B%AE%E5%BD%95%E4%B9%9F%E6%9C%89%E6%AD%A3%E7%A1%AE%E6%9D%83%E9%99%90%E3%80%82%0A%0A4.%20%2A%2ASELinux/AppArmor%2A%2A%20%20%0A%20%20%20%E5%A6%82%E6%9E%9C%E4%BD%A0%E7%9A%84%E7%B3%BB%E7%BB%9F%E5%90%AF%E7%94%A8%E4%BA%86%20SELinux%20%E6%88%96%20AppArmor%EF%BC%8C%E5%8F%AF%E8%83%BD%E8%BF%98%E9%9C%80%E8%A6%81%E6%94%BE%E5%AE%BD%E7%AD%96%E7%95%A5%EF%BC%8C%E5%85%81%E8%AE%B8%20Dify%20%E5%86%99%E5%85%A5%E8%AF%A5%E7%9B%AE%E5%BD%95%E3%80%82%0A%0A5.%20%2A%2A%E9%87%8D%E8%AF%95%E8%AE%BE%E7%BD%AE%E7%AE%A1%E7%90%86%E5%91%98%E8%B4%A6%E5%8F%B7%2A%2A%20%20%0A%20%20%20%E6%9D%83%E9%99%90%E4%BF%AE%E5%A4%8D%E5%90%8E%EF%BC%8C%E9%87%8D%E6%96%B0%E8%BF%90%E8%A1%8C%E8%AE%BE%E7%BD%AE%E6%B5%81%E7%A8%8B%E3%80%82%0A%0A%E5%8F%AA%E8%A6%81%E4%BF%9D%E8%AF%81%20Dify%20%E8%BF%9B%E7%A8%8B%E7%94%A8%E6%88%B7%E5%AF%B9%20%60privkeys%60%20%E7%9B%AE%E5%BD%95%E6%9C%89%E5%86%99%E6%9D%83%E9%99%90%EF%BC%8C%E9%97%AE%E9%A2%98%E4%B8%80%E8%88%AC%E5%8F%AF%E4%BB%A5%E8%A7%A3%E5%86%B3%E3%80%82%E5%A6%82%E6%9E%9C%E8%BF%98%E6%9C%89%E9%97%AE%E9%A2%98%EF%BC%8C%E5%8F%AF%E4%BB%A5%E8%B4%B4%E4%B8%80%E4%B8%8B%E4%BD%A0%E7%9A%84%E6%9D%83%E9%99%90%E6%A3%80%E6%9F%A5%E7%BB%93%E6%9E%9C%E5%92%8C%E8%BF%90%E8%A1%8C%E7%8E%AF%E5%A2%83%E7%BB%86%E8%8A%82%E3%80%82)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28792)
Author
Owner

@warlock-lv commented on GitHub (Nov 27, 2025):

[root@VM-0-16-tencentos dify]# ps aux | grep dify
1001 598209 0.3 1.4 726388 55360 ? Sl 19:25 0:00 node /pnpm/global/5/.pnpm/pm2@6.0.14/node_modules/pm2/bin/pm2 start /app/web/server.js --name dify-web --cwd /app/web -i 2 --no-daemon
avahi 599605 0.0 0.1 176560 6892 ? Ss 19:25 0:00 postgres: postgres dify_plugin 172.25.0.7(50022) idle
avahi 599617 0.1 0.3 182864 14456 ? Ss 19:25 0:00 postgres: postgres dify_plugin 172.25.0.7(50024) idle
avahi 617563 0.0 0.4 176688 15560 ? Ss 19:26 0:00 postgres: postgres dify 172.25.0.9(56194) idle
avahi 618167 0.0 0.3 176656 14636 ? Ss 19:27 0:00 postgres: postgres dify 172.25.0.8(57264) idle
root 620121 0.0 0.0 219968 1044 pts/1 S+ 19:28 0:00 grep --color=auto dify
[root@VM-0-16-tencentos dify]# ls -ld privkeys
drwxrwxrwx 2 1000 1000 4096 Nov 27 18:58 privkeys
[root@VM-0-16-tencentos dify]# ls -ld privkeys/*
ls: cannot access 'privkeys/*': No such file or directory
@dosubot

@warlock-lv commented on GitHub (Nov 27, 2025): [root@VM-0-16-tencentos dify]# ps aux | grep dify 1001 598209 0.3 1.4 726388 55360 ? Sl 19:25 0:00 node /pnpm/global/5/.pnpm/pm2@6.0.14/node_modules/pm2/bin/pm2 start /app/web/server.js --name dify-web --cwd /app/web -i 2 --no-daemon avahi 599605 0.0 0.1 176560 6892 ? Ss 19:25 0:00 postgres: postgres dify_plugin 172.25.0.7(50022) idle avahi 599617 0.1 0.3 182864 14456 ? Ss 19:25 0:00 postgres: postgres dify_plugin 172.25.0.7(50024) idle avahi 617563 0.0 0.4 176688 15560 ? Ss 19:26 0:00 postgres: postgres dify 172.25.0.9(56194) idle avahi 618167 0.0 0.3 176656 14636 ? Ss 19:27 0:00 postgres: postgres dify 172.25.0.8(57264) idle root 620121 0.0 0.0 219968 1044 pts/1 S+ 19:28 0:00 grep --color=auto dify [root@VM-0-16-tencentos dify]# ls -ld privkeys drwxrwxrwx 2 1000 1000 4096 Nov 27 18:58 privkeys [root@VM-0-16-tencentos dify]# ls -ld privkeys/* ls: cannot access 'privkeys/*': No such file or directory @dosubot
Author
Owner

@crazywoola commented on GitHub (Nov 27, 2025):

【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)

@crazywoola commented on GitHub (Nov 27, 2025): 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
Author
Owner

@lzq13011123076-coder commented on GitHub (Nov 27, 2025):

do enter the api container as root,“docker exec -it -u root ad7a755dda3f bash”, then "chown dify:dify /app/api/storage"

@lzq13011123076-coder commented on GitHub (Nov 27, 2025): do enter the api container as root,“docker exec -it -u root ad7a755dda3f bash”, then "chown dify:dify /app/api/storage"
Author
Owner

@wangjiezju1988 commented on GitHub (Nov 28, 2025):

I meet the same problem while I use root to start docker, how to salve this problem?

Setup failed: PermissionDenied (persistent) at write => permission denied Context: service: fs path: privkeys/d09a685f-9eb7-47f6-a35c-cb9ef989d44a/private.pem Source: Permission denied (os error 13)"
Image
@wangjiezju1988 commented on GitHub (Nov 28, 2025): I meet the same problem while I use root to start docker, how to salve this problem? ``` Setup failed: PermissionDenied (persistent) at write => permission denied Context: service: fs path: privkeys/d09a685f-9eb7-47f6-a35c-cb9ef989d44a/private.pem Source: Permission denied (os error 13)" ``` <img width="996" height="369" alt="Image" src="https://github.com/user-attachments/assets/fcd04af8-6362-4afb-8487-8d8588e37d5b" />
Author
Owner

@ZiAn-Su commented on GitHub (Nov 30, 2025):

do enter the api container as root,“docker exec -it -u root ad7a755dda3f bash”, then "chown dify:dify /app/api/storage"

chown -R dify:dify /app/api/storage

@ZiAn-Su commented on GitHub (Nov 30, 2025): > do enter the api container as root,“docker exec -it -u root ad7a755dda3f bash”, then "chown dify:dify /app/api/storage" **chown -R dify:dify /app/api/storage**
Author
Owner

@wangxiaodong1021 commented on GitHub (Dec 1, 2025):

do enter the api container as root,“docker exec -it -u root ad7a755dda3f bash”, then "chown dify:dify /app/api/storage"

chown -R dify:dify /app/api/storage

The latest version encountered the same problem, and following this operation did not resolve it.

@wangxiaodong1021 commented on GitHub (Dec 1, 2025): > > do enter the api container as root,“docker exec -it -u root ad7a755dda3f bash”, then "chown dify:dify /app/api/storage" > > **chown -R dify:dify /app/api/storage** The latest version encountered the same problem, and following this operation did not resolve it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20615