Timo Sirainen wrote:
On Mon, 2009-08-24 at 11:13 -0600, Ashley M. Kirchner wrote:
I'm in the process of upgrading an old server which is running uw-imap to a new one running Dovecot. With the old machine, unfortunately, my users had the opportunity to store their e-mails in various locations. For example, some have their mail boxes stored in ~/mail/[various mbox files], others ALSO have a ~/mail/clients/[various mbox files] and yet others simply stored them in their ~/ path (thanks to the old IMAP). Is there a way to create per-user namespaces? I don't want to create a "mail/", "mail/clients/", etc., etc. global name space that will end up showing up on everyone's mail client, nor do I want to individually change each user's setup (and rewrite their .subscriptions file).
I think the best solution would be to just finally standardize everyone's mailboxes under ~/mail/. It'll probably help you in future..
But yeah, it's possible to create per-user namespaces by returning namespace_* extra fields from your userdb. There isn't existing documentation how exactly to do that, but basically you'll just have to return the same namespace_* fields that exist in NAMESPACE_* environment variables. You can get a dump of those using post-login script, see http://wiki.dovecot.org/PostLoginScripting. Alternatively you could just set up those NAMESPACE_* settings directly in the post-login script by e.g. reading some file from home dir. But don't let users specify anything, the process is still running as root at that point and they'll get root privileges by changing just a few environment settings..
http://wiki.dovecot.org/Plugins/Virtual also gives a simple example how to return a different inbox=yes namespace for different users.
It sounds like a similar issue I had to deal with, I ended up making several global name-spaces equivalent to ~, ~/mail, and ~/Mail but I made the last two hidden so legacy client setups will still work but new clients would not automatically find them. The only drawback I found was client apparently could not see my public folder namespaces unless they used the ~ namespace (blank prefix in the client). Since so few of my users need public folders I was fine with that.