Debian

錯誤:無法刪除權限:使用者缺少 UID(請參閱 mail_uid 設置)

  • January 11, 2020

我有一個圍繞 ISPMail 指南鬆散設置的電子郵件系統 - https://workaround.org/ispmail/buster/

我正在嘗試為自動密碼方案遷移設置腳本,但遇到了問題。我一直在遵循與此類似的指南:https ://wiki.dovecot.org/HowTo/ConvertPasswordSchemes

每當我啟用 userdb 預取時,都會Couldn't drop privileges: User is missing UID (see mail_uid setting)出現錯誤。

我的 user_query 和 password_query 如下:

user_query = SELECT user, \ concat('*:bytes=', quota) AS quota_rule, \ '/var/vmail/%d/%n' AS home, \ 5000 AS uid, 5000 AS gid \ FROM users WHERE user='%u';

password_query = SELECT user, password, \ '%w' AS userdb_plain_pass, \ concat('*:bytes=', quota) AS quota_rule, \ '/var/vmail/%d/%n' AS home, \ 5000 AS uid, 5000 AS gid \ FROM users WHERE user='%u';

我有以下配置:(按此順序)

passdb { driver = sql args = /etc/dovecot/dovecot-sql.conf.ext } userdb { driver = prefetch } userdb { driver = sql args = /etc/dovecot/dovecot-sql.conf.ext }

查看調試日誌,當我刪除預取並且一切都按預期工作時:

Jan 5 15:21:38 m1 dovecot: auth: Debug: master userdb out: USER#0114090494977#011aaron@example.com#011plain_pass=Password1234#011quota_rule=*:bytes=0#011home=/var/vmail/example.com/aaron#011uid=5000#011gid=5000#011auth_token=bdxxxxx

但是,啟用預取時,它不會獲取 passdb 中的 uid 和 gid:

Jan 5 15:18:36 m1 dovecot: auth: Debug: master userdb out: USER#0113382444033#011aaron@example.com#011plain_pass=Password1234#011auth_token=bdxxxx

關於使用預取時如何解決此問題的任何建議?

謝謝!

原來我的 passdb 查詢缺少userdb_前綴。如下調整它解決了這個問題。

password_query = SELECT user, password, \
 '%w' AS userdb_plain_pass, \
  concat('*:bytes=', quota) AS quota_rule, \
  '/var/vmail/%d/%n' AS home, \
  5000 AS userdb_uid, 5000 AS userdb_gid \
  FROM users WHERE user='%u';

關於預取使用者數據庫的Dovecot文件

Prefetch 的工作原理是要求 passdb 在帶有userdb_前綴的額外欄位中返回 userdb 資訊。例如,如果 userdb 通常返回uid,gidhome欄位,則 passdb 必須返回userdb_uid,userdb_giduserdb_home欄位。

引用自:https://serverfault.com/questions/997690