[Dovecot] Override maildir for just a few users

Jiri Bourek bourek at thinline.cz
Wed Apr 9 21:58:54 UTC 2014


Charles Marcus wrote:
> Hi all,
>
> Currently, I have mail_location = maildir:~/Maildir set and all passdb
> and userdb lookups are SQL based (doveconf -n pasted below).
>
> However, I want to override the users maildir location - and *only* the
> maildir location - for just a few users.
>
> I was thinking the easiest way would be to add a simple flat file based
> userdb that is checked before the SQL based one, where I can define a
> different maildir for these users.
>
> So, basically, dovecot checks the flat file first, and if the user isn't
> found, falls back to SQL.
>
> I still want all AUTH to go through SQL...
>
> It seems like this should be fairly simple, but after reading the wiki
> for a few days, I'm just not sure...

I'd start here:

http://wiki2.dovecot.org/UserDatabase/ExtraFields

You can try to add userdb_import column into your users table, return it 
in userdb lookup. Leave the column empty (NULL) for most users, put 
mail_location=xxxxx for those you want to override.

At least that's how I understand the wiki page, never actually tested 
this myself. And I'm not completely sure on the mail_location=xxxxx syntax

>
> This is on a production box, so I have to be careful (note to self -
> MUST set up testing box for things like this)...

I *think* adding a column with NULL values and returning it in userdb 
lookup shouldn't change anything until you actually put something 
non-NULL into the column for some user. Again, never tested this myself, 
but if I'm right, you can change the table schema and SQL query without 
any impact on existing users. After that you can create new user for 
experiments.

Test this on your own risk (and get the testing box ;-))

>
> Is anyone else doing anything like this, and if so would you be willing
> to share sanitized configs?
>
> Thx,
>



More information about the dovecot mailing list