userdb passwd-file default_fields uid not expanding %variable

Tim Jones tim.jones at fon.com
Fri Feb 27 18:20:31 UTC 2015


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


More information about the dovecot mailing list