Courier-IMAP Shared Folders Setup [FreeBSD]

I had a need to share a folder or 2 with my wife. I did not want her accessing my email, and I did not want to access hers. I also did not want to be emailing back and forth attachments. This was not something I wanted to waste bandwidth on.

Courier-IMAP supports shared folders. Here is how I did it on a FreeBSD 6.x server.

First, I wanted them to be centralized. I did not want to share a directory in my Maildir. Nor did I want to share one of her directories in her Maildir.

maildirmake: creates maildirs and maildir folders. Specifically this section of the man file (I really recommend reading the man file)

-S create a “sharable” maildir. A sharable maildir has slightly different permissions which allows creation of publicly-shared folders.

And

-s mode create a publicly accessible folder in an existing sharable maildir. First, use the -S option to create a sharable maildir. Then, run maildirmake again with the -s option to create publicly accessible folders. mode is a comma-separated list of the following keywords: read - readonly folder, only you can write messages to this folder; write - anyone can read and write messages to this folder; group - only allow members of your own system group to access messages in this folder (instead of everyone).

I wanted this shared folder to be writable by myself and her only.
First you need to create a Maildir for you to share:
#maildirmake -S /home/shared

Now make it shareable:
#maildirmake -s write -f shared /home/shared/Maildir/

Then ‘cd’ into it:
#cd /home/shared/Maildir/.shared/

If you do an ‘ls -al’ in that directory it should look like this:

#ls-al
total 10
drwxr-xr-t 5 root wheel 512 Jul 9 20:25 .
drwxr-xr-x 6 root wheel 512 Jul 9 20:25 ..
drwxrwxrwt 2 root wheel 512 Jul 9 20:25 cur
-rw------- 1 root wheel 0 Jul 9 20:25 maildirfolder
drwxrwxrwt 2 root wheel 512 Jul 9 20:25 new
drwxrwxrwt 2 root wheel 512 Jul 9 20:25 tmp

Now change the permissions on the new directory:
#chmod -o-t new/

Another ‘ls -al’ gives you this:

#lsl
total 10
drwxr-xr-t 5 root wheel 512 Jul 9 20:25 .
drwxr-xr-x 6 root wheel 512 Jul 9 20:25 ..
drwxrwxrwt 2 root wheel 512 Jul 9 20:25 cur
-rw——- 1 root wheel 0 Jul 9 20:25 maildirfolder
d—-w–w- 2 root wheel 512 Jul 9 20:25 new
drwxrwxrwt 2 root wheel 512 Jul 9 20:25 tmp

Here is a list of who has what access:

#maildiracl -list /home/shared/Maildir/ INBOX.shared
owner aceilrstwx
administrators aceilrstwx

See the alphabet soup after owner and administrators? That is why you want to read the man file for these programs. If you don’t, you will never figure them out.

I added myself to this list, as I want to be full unadulterated admin of this shared folder:
#maildiracl -set /home/shared/Maildir/ INBOX.shared myuser +aceilrstwx


#maildiracl -list /home/shared/Maildir/ INBOX.shared
owner aceilrstwx
administrators aceilrstwx
myuser aceilrstwx

Good, now I am admin of this folder.

Here is my wifes account, I did not want her to beable to delete the shared folder, nor delete anything out of the shared folder. Not that she cannot handle the responsibilities, but the children will play with her laptop from time to time, and they might delete the folder, ruining all this hard work.
#maildiracl -set /home/shared/Maildir/ INBOX.shared wifee +cilrsw

Here is what the acl list looks like now:

#maildiracl -list /home/shared/Maildir/ INBOX.shared
owner aceilrstwx
administrators aceilrstwx
myuser aceilrstwx
wifee cilrsw

You should understand that you really need to be in complete control of the server if you wish this to work, and I cannot guaranty this will work for everyone on any distrobution of Linux or OS X. It does work on my server, which runs FreeBSD 6.x, Exim4 Courier-IMAP, FAM and Spamassassin. The only part that could make this either easier, harder, slower or faster is FAM.

It would also be good to read the man files (notice a pattern here?)

man maildiracl
man maildirmake

Now, in your IMAP client, you need to subscribe to shared folders. It should show your shared folder just like it shows your inbox. If you did this correctly, and your server supports it, you will see the shared folder.

Tags: , , , ,
permalinkRead More CommentComments (0) CatCourier-IMAP, FreeBSD, IMAP, SharedFolders

Leave a Reply

You must be logged in to post a comment.