Could not override "mail_location" with "userdb_mail" statment in "/etc/passwd"

Aki Tuomi aki.tuomi at open-xchange.com
Mon Feb 13 09:48:49 UTC 2023


> On 13/02/2023 11:36 EET Xavier <xavier-mlist at proton.me> wrote:
> 
> 
> Hi,
> 
> ** Using Dovecot 2.2.22 and Postfix 3.1.0 **
> 
> I plan to migrate all accounts on my server from mbox to maildir storage but before i want to make some tests on dedicated accounts. To do so i want to overide the general "mail_location" ( mail_location = mbox:~/mail:INBOX=/var/mail/%u ) with "maildir:~/Maildir" only for some test accounts.
> 
> To do so i modified my "/etc/passwd" file using something like that :
> 
> testm2m_mydomain.tld:x:2122:2122::/home/mail/testm2m_mydomain.tld:/bin/false:userdb_mail=maildir:~/Maildir
> Also tried
> testm2m_mydomain.tld:x:2122:2122::/home/mail/testm2m_mydomain.tld:/bin/false::userdb_mail=maildir:~/Maildir
> 
> And as mentioned in the doc (https://wiki.dovecot.org/LDA/Postfix) i added -d "$USER" in my Postfix "mailbox_command" but it don't seem to work (my new mail_location for this test user is is not taken into account).
> 
> When i try to make an "doveadm user testm2m_mydomain.tld" i get this :
> 
> 8<--------------------------------
> field value
> uid 2122
> gid 2122
> home /home/mail/testm2m_mydomain.tld
> mail mbox:~/mail:INBOX=/var/mail/testm2m_mydomain.tld
> system_groups_user testm2m_mydomain.tld
> 8<--------------------------------
> 
> My modification is not taken into account ...
> 
> Any help is welcome !
> 
> /Xavier

Hi!

You need to use passwd-file driver. I would recommend adding secondary userdb for overrides in a separate file instead of modifying /etc/passwd.

userdb {
  driver = passwd
  result_success = continue-ok
}

userdb {
  driver = passwd-file
  args = /etc/dovecot/overrides
}

and put in overrides

testm2m_mydomain.tld:::::::userdb_mail=maildir:~/Maildir

Aki


More information about the dovecot mailing list