On 17/12/2024 05:52 EET Stanislav via dovecot <dovecot@dovecot.org> wrote:
You could get rid of the static userdb with these settings
mail_uid = 981 mail_gid = 981 mail_home = /var/mail/virtual/%d/%n/home
and ensure you have iterate_query in your SQL config.
Should do the trick.
Thanks, Aki!
I added those properties and also commented out the following line: user_query = SELECT maildir, 981 AS uid, 981 AS gid FROM mailbox WHERE username='%u' and active='1'
After that, I started seeing errors like: dovecot[29855]: auth-worker(29871): Warning: sqlpool(mysql): Query failed, retrying: Table 'mail.users' doesn't exist dovecot[29855]: auth-worker(29871): Error: conn unix:auth-worker (uid=143): auth-worker<26>: sql(omitted,<nFRU7G4pK jsEDmqT>): User query failed: Table 'mail.users' doesn't exist (using built-in default user_query: SELECT home, uid, gid FROM users WHERE username = '%n' AND domain = '%d')
To fix it, I set user_query to this: user_query = SELECT username FROM mailbox WHERE username='%u' AND active='1'
Now, it returns the "username" but I’m not sure how useful that is for Dovecot in the user_query context. That said, everything seems to be working fine now.
Does this look like the right approach?
Thanks!
Looks about right. You need to return something and this normalizes a username as well.
Aki