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

Dovecot migration from static to passwd-file userdb driver

· 52CE 我爱测

I have an email server set to use dovecot with virtual users : passdb { driver = passwd-file args = username_format=%n /etc/vmail/%d/users } userdb { driver = static args = uid=109 gid=111 home=/home/vmail/%d/%n } Now I need to s…

问题原文

原帖链接 · Skippy le Grand Gourou · CC BY-SA 4.0

I have an email server set to use dovecot with virtual users :

passdb {
  driver = passwd-file
  args = username_format=%n /etc/vmail/%d/users
}

userdb {
  driver = static
  args = uid=109 gid=111 home=/home/vmail/%d/%n
}

Now I need to set storage quotas for some users. Apparently this isn't possible with the static driver, so I figured the simplest way to enable it would be to switch to passwd-file. However I struggle to actually get it working.

Using the same passdb as above and

userdb {
  driver = passwd-file
  args = username_format=%n /etc/vmail/%d/users
  default_fields = uid=vmail gid=vmail home=/home/vmail/%d/%n
}

93.184.216.34 I get the following errors :

dovecot: imap: Error: Authenticated user not found from userdb, auth lookup id=345505793 (client-pid=30121 client-id=1)

dovecot: auth: Error: passwd-file([email omitted],93.184.216.34,): user not found from userdb

I tried many variations and read many pages of the dovecot wiki, including AuthDatabase/PasswdFile, but I can't seem to interpret the documentation correctly.

How do I transpose my static configuration into a passwd-file with minimal modifications ?

/etc/vmail/%d/users files are of the standard form

user:{SHA512}…

And here is the output of dovecot userdb for these settings :

userdb {
  args = username_format=%n /etc/vmail/%d/users
  auth_verbose = default
  default_fields = uid=vmail gid=vmail home=/home/vmail/%d/%n
  driver = passwd-file
  name = 
  override_fields = 
  result_failure = continue
  result_internalfail = continue
  result_success = return-ok
  skip = never
}

已采纳解答

原帖链接 · Skippy le Grand Gourou · CC BY-SA 4.0

I wrongly assumed that fields other than user and password were optional since default_fields would take care of them.

Actually, the documentation states (emphasis mine)

[The password file is] in the following format:

user:password:uid:gid:(gecos):home:(shell):extra_fields

For a password database it's enough to have only the user and password fields. For a user database, you need to set also uid, gid and preferably also home (see VirtualUsers). (gecos) and (shell) fields are unused by Dovecot.

So those fields are actually mandatory. But since they are already set by default_fields, they can be empty :

user:{SHA512}pwd:::

I figured it by chance because the only working account was the one I was testing the quota on (using the per user userdb_quota_rule extra field)…

The doveadm user [email omitted] was also very useful for debugging this issue.

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

资料来源与适用范围

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

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

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