Re: using shared mail folders in MIX

David B Funk <[email protected]> Tue, 13 Apr 2010 22:00:02 -0500 (CDT)
Newsgroups gmane.mail.imap.uw.c-client
Message-ID <[email protected]>
On Tue, 13 Apr 2010, Andrew Daviel wrote:

> On Mon, 12 Apr 2010, Mark Crispin wrote:
>
> > On Mon, 12 Apr 2010, Andrew Daviel wrote:
> >> - question: if using the MIX format, what happens to the ownership and
> >> permissions of new folder fragments (whatever .mixnnn files are called)
> >> in shared folders ? Do they get set with mode 600 hence become unreadable
> >> by other group members ?
> >
> > Mailboxes in #shared are created with mode 660 for files and 770 for
> > directories.
>
> I created a group writable folder viz.
> drwxr-xr-x  6 imapshared imapshared /home/imapshared/
> drwxrwx---  4 imapshared CCN  /home/imapshared/CCN
> drwxrwx---  2 imapshared CCN  /home/imapshared/CCN/INBOX/
> -rw-rw----  1 imapshared CCN  /home/imapshared/CCN/INBOX/.mix4bc4ef04
>
> An email account "sharetest" which is a member of CCN can deliver mail to
> it using  "dmail +#shared/CCN/INBOX"
> and members of the group CCN can read it. So far so good.
>
> However, if a member of CCN "andrew" writes a lot of messages into
> this folder using IMAP, the next datafile is created belonging to
> him, viz.
> -rw-rw----  1 andrew andrew /home/imapshared/CCN/INBOX/.mix4bc51158
> Subsequent messages cannot be delivered from dmail, because the file is
> no longer writable.

Use the Unix "group SGID bit" on the directory to force new files to
keep the desired group membership. Using your example:

 drwxrwx---  4 imapshared CCN  /home/imapshared/CCN
 drwxrws---  2 imapshared CCN  /home/imapshared/CCN/INBOX/
 -rw-rw----  1 imapshared CCN  /home/imapshared/CCN/INBOX/.mix4bc4ef04
 -rw-rw----  1 andrew     CCN  /home/imapshared/CCN/INBOX/.mix4bc51158

Note the 'SGID' bit on the INBOX directory.
Then when your user "andrew" creates a new  MIX datafile in that INBOX
directory it will be group CCN.

This is just classical Unix permissions voo-doo which came out of BSD
land. Ancient sys-V Unix varients may not implement it, but all
this-millenium Unix varients should. ;)

Depending upon the OS/filesystem features you also may be able to
use ACLs.