[Dovecot] How to create home directories for virtual users?

Tom Hendrikx tom at whyscream.net
Thu Nov 24 21:50:39 EET 2011


On 24-11-11 20:29, Timo Sirainen wrote:
> On Thu, 2011-11-24 at 21:23 +0200, Olli Räisänen wrote:
>> Tom Hendrikx kirjoitti 2011-11-24 kello 18:13:47:
>>>
>>> How about using /srv/vmail/%d/%n for homedir, and /srv/vmail/%d/%n/mail
>>> as mailstore?
>>
>> Well, yes - at least the home directory will be created that way. Still, 
>> PostfixAdmin will not store the path in the maibox table home field. Perhaps 
>> it is enough to include the path in the Dovecot user_query?  
> 
> It would be better if you used PostfixAdmin's "maildir" field as the
> home directory, and then mail_location=~/Maildir. Like the sql queries
> being:
> 
> password_query = \
>   SELECT username AS user, password, \
>     CONCAT('/home/vmail/', maildir) AS userdb_home, \
>     CONCAT('*:bytes=', quota) AS userdb_quota_rule \
>   FROM mailbox \
>   WHERE username = '%u' and ACTIVE = '1'
> 
> user_query = \
>   SELECT CONCAT('/home/vmail/', maildir) AS home, \
>     CONCAT('*:bytes=', quota) AS quota_rule \
>   FROM mailbox \
>   WHERE username = '%u' AND active = '1'
> 
> I used these in another PostfixAdmin server's install.
> 

I even simplified this up to:

# taken from stock dovecot2 config
userdb {
        driver = static
        args = uid=vmail gid=mail home=/var/spool/vmail/%u
}
mail_location = maildir:~/Maildir

password_query = SELECT username AS user, password FROM mailbox WHERE
username = '%u' AND active = '1'

(no quota's, no special cases for home/mail directory configuration)
--
Tom



More information about the dovecot mailing list