“Easy share” IMAP folders with Courier-imap | Just my blog

/dev/random

“Easy share” IMAP folders with Courier-imap

Recently I got a iPhone, but I have multiple mails coming into my mailbox (private/business/sysop). I use maildrop to put them into the right folders. I want share my business (sub)folder(s) with my special iPhone-account... but how could we do that... (please note you should have admin-privileges)

Step 1 - Create new user and put the "source" mailbox user in the right group

Create a iPhone user on your server (in my case user is iphone) and add the user (in my case pieter) to the iphone group (created during the creation of the iphone user).

Step 2 - Set permissions correct of the source mailbox

Make sure the world can access ~pieter/Maildir, set this by entering:

[ [email protected] ~]# chmod o+x ~pieter/Maildir

New we also have to set the grouppermissions correct of the source sub-folders:

[ [email protected] ~]# chown -R pieter:iphone ~pieter/Maildir/.Business*

Set groupbit and grouppermissions on the folders you want to share:

[ [email protected] ~]# find ~pieter/Maildir/.Business* -type d -exec chmod 2770 {} ;

Set the grouppermissions on the current messages"

[ [email protected] ~]# find ~pieter/Maildir/.Business* -type f -exec chmod  0660 {} ;

Step 3 - Setup the functional account and mailstructure

Become that user (can be done via sudo).
[ [email protected] ~]$ sudo su - iphone
Password: ****
[ [email protected] ~]$

Create the maildir structure:

[ [email protected] ~]$ maildirmake ~/Maildir

Remove the cur, new and tmp folders:

[ [email protected] ~]$ rm -rf ~/Maildir/[cnt]*

Now link them to the source:

[ [email protected] ~]$ for x in cur new tmp; do ln -s /home/pieter/Maildir/.Business/$x ~iphone/Maildir/$x; done

Step 4 - Share the subfolders as well

[ [email protected] ~]$ cd ~/Maildir
[ [email protected] Maildir]$ maildirmake .Archive
[ [email protected] Maildir]$ rm -rf ~/.Archive/[cnt]*
[ [email protected]erver Maildir]$ for x in cur new tmp; do ln -s /home/pieter/Maildir/.Business.Archive/$x ~iphone/Maildir/.Archive/$x; done

Perform step 4 for al the other subfolders you would like to share ;-) (Please note that you've to set the permissions in step 2 as well). This was done on a FreeBSD6.3 system, I don't know what the impact might be on Linux systems with SELinux... nor I don't know what the impact might be of the chmod o+x on Maildir... we wil investigate. Initially I did a chown pieter:iphone on the source maildir... but my imap-server refused connection due to wrong gid.

Also keep in mind to put in your procmail/maildrop filter a umask of 007!

But... conclusion... it works cool.


  • Social

  • By continuing to use the site, you agree to the use of cookies. more information

    The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible and enable advertising to provide you free content. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

    Close