First, sorry for the double post, not sure how that happened. Secondly, I should add the userdb error happens as soon as any connection attempt is map to the pop3\imap port, before a login command can be sent. Obviously, since no login is started, there will be no username from which to extract the %d domain name variable. So the error makes sense. My problem is that the userdb is being checked upon connection rather than login, is there a way to bypass or disable that. Or maybe a 'failover' userdb to try if the correct one fails.
Many thanks, Tim Jones Software Development +34 612345678 C/ Quintanavides 15, Edificio 2, Planta 1ª Parque Empresarial Vía Norte de Metrovacesa Las Tablas 28050 Madrid Skype: tim.jones.fon All information in this email is confidential On 27 February 2015 at 19:20, Tim Jones <tim.jo...@fon.com> wrote: > Hi all, > > I'm trying to set up a very simple shared mail server, where each > 'domain' is a system user, i.e. 'example.com' is a real user with > /home/example.com/, a uid of 5001 (and gid 'example.com' of 5001). > Each domain\user has their own maildir inside their home, and a plain > passwd-file with the virtual mail users associated with that domain. > > Version & config info: > > # dovecot -n > # 2.2.13: /etc/dovecot/dovecot.conf > # OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.8 > auth_mechanisms = plain login > auth_verbose = yes > disable_plaintext_auth = no > mail_location = mbox:~/mail:INBOX=/var/mail/%u > namespace inbox { > inbox = yes > location = > mailbox Drafts { > special_use = \Drafts > } > mailbox Junk { > special_use = \Junk > } > mailbox Sent { > special_use = \Sent > } > mailbox "Sent Messages" { > special_use = \Sent > } > mailbox Trash { > special_use = \Trash > } > prefix = > } > passdb { > args = username_format=%n /home/%d/mail_users > driver = passwd-file > } > protocols = " imap lmtp pop3" > ssl = no > userdb { > args = username_format=%n /home/%d/mail_users > default_fields = uid=%d gid=%d home=/home/%d/mail/%n > mail=maildir:/home/%d/mail/%n > driver = passwd-file > } > > Every time I try to authenticate via imap, I get the error > >> <timestamp> <host> dovecot: auth: Fatal: passwd-file userdb: Invalid uid: %d > > > If I put fixed a uid and gid in the userdb default_fields line: > >> default_fields = uid=example.com gid=example.com home=/home/%d/mail/%n >> mail=maildir:/home/%d/mail/%n > > authentication passes without a problem, but of course, only for users > of example.com. > > Checking the wiki > (http://wiki2.dovecot.org/UserDatabase#Userdb_settings) clearly states > that the default_fields values support %variables, so I'm not sure if > I'm missing some other config required for this to work. > > Many thanks in advance, > > Tim Jones > Software Development > +34 612345678 > C/ Quintanavides 15, Edificio 2, Planta 1ª > Parque Empresarial Vía Norte de Metrovacesa > Las Tablas > 28050 Madrid > Skype: tim.jones.fon > All information in this email is confidential