Permissions for files written by procmail-wrapper?

Hi all,

I’d like to share Maildir-style mailboxes between two users within the same domain. To access the shared maildir over IMAP (Dovecot 2.x) without to much fuss, I’ve symlinked it. Works, so far.

Unfortunately, new mail that is placed in the shared mailbox is written with file permissions 600 (instead of 660 or something similar). How could I

a) make procmail-wrapper use a more readable file mode? This would make my symlinking work, or
b) share the Maildir any other way, without fiddling with executig IMAP commands over telnet because of lack of support for shared namespaces?

For the record: I’m running Virtualmin Pro on Ubuntu 64 bit.

Any help is appreciated. Kind regards,

Christian

I’d like to add that the reason why I’m trying this is because the Virtualmin vacation mailer is so overzealous. It’ll happily try to send responses to anything coming in: “precendence: bulk” spam mails, forum & list mails, automatic notifications from webmin/virtualmin and whatnot. No way to stop it from that, as I see it.

To keep my inbox from exploding after some days off, I’ve set up two separate users:

(1) is my main account, the one that I’m using to send email.
(2) is my address for all kinds of automatic notifications

Only (1) will have a vacation message set up when I’m away. To read email from (2) without the need to configure a separate account in every piece of email software I use, I’ve symlinked it’s Maildir to (1). Setting up and using full-featured shared namespaces on Dovecot and IMAP is a major PITA, so I refrained from doing that.

You’re lucky, just two weeks ago I had to do the same thing, i.e. configure shared Dovecot folders. I’ll get back to you shortly when I’m on my PC, I need to look up the method to fix the mail file permissions.

Okay, here’s what I did:

In addition to the usual configuration of Dovecot to turn on shared namespaces and authentication and stuff, I created a Linux group named “sharedmail”. I set the owner group of the Maildir (and all its subdirectories) of the user that was to be shared to “sharedmail” and permissions to “770”.

I added all users who were to have access to the shared folders to the group “sharedmail”.

In /etc/procmailrc I added the directive UMASK=007 which causes procmail to create all mail files with permissions 770 (the umask is the binary inversion of the desired permission bits).

That should do it.

Additional info:

  1. If you wish per-user Seen flags in the shared mailbox, you need to create an empty file named dovecot-shared in the shared Maildir. Contents don’t matter, only existence of the file is required.

  2. If newly created IMAP folders don’t get the “sharedmail” group, you need to set the Set Group ID permission flag on the Maildir folder. On a directory, that flag causes newly created files/folders to inherit the parent folder’s group ownership, as opposed to the primary group of the creating user.

  3. There’s a nice IMAP Permissions plugin for Thunderbird, in case you use that.

Ah, /etc/procmailrc… I was missing that last bit. It’s not mentioned in the help output, nor is there a manpage for procmail-wrapper, or is it?

Will try that out immediately. Thanks a lot, Locutus.

Nice information. It’s very useful for me.