大网数据广告活动
服务器运维问答

Error: Couldn't drop privileges: User is missing UID (see mail_uid setting)

· 52CE 我爱测

I have an email system that is setup loosely around the ISPMail guides here - https://workaround.org/ispmail/buster/ I am trying to setup a script for automatic password scheme migration, but I'm running into issues. I've been fo…

问题原文

原帖链接 · Aaron A · CC BY-SA 4.0

I have an email system that is setup loosely around the ISPMail guides here - https://workaround.org/ispmail/buster/

I am trying to setup a script for automatic password scheme migration, but I'm running into issues. I've been following guides similiar to this: https://wiki.dovecot.org/HowTo/ConvertPasswordSchemes

Whenever I enable userdb prefetch, the Couldn't drop privileges: User is missing UID (see mail_uid setting) error appears.

My user_query and password_query are as follows:

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';

I have the following configuration in place: (In this order)

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

Looking at the debug logs, when I remove the prefetch and everything works as expected:

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

However, when prefetch is enabled, it's not getting the uid and gid in the passdb out:

Jan 5 15:18:36 m1 dovecot: auth: Debug: master userdb out: USER#0113382444033#[email omitted]#011plain_pass=Password1234#011auth_token=bdxxxx

Any suggestions on how to resolve this issue when using prefetch?

Thanks!

已采纳解答

原帖链接 · Aaron A · CC BY-SA 4.0

Turns out my passdb query was missing the userdb_ prefixes. Adjusting it as follows solved the problem.

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 Documentation on Prefetch User Database:

Prefetch basically works by requiring that the passdb returns the userdb information in extra fields with userdb_ prefixes. For example if a userdb typically returns uid, gid and home fields, the passdb would have to return userdb_uid, userdb_gid and userdb_home fields.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-01-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。