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:
[ root@server ~]# chmod o+x ~pieter/Maildir
New we also have to set the grouppermissions correct of the source sub-folders:
[ root@server ~]# chown -R pieter:iphone ~pieter/Maildir/.Business*
Set groupbit and grouppermissions on the folders you want to share:
[ root@server ~]# find ~pieter/Maildir/.Business* -type d -exec chmod 2770 {} ;
Set the grouppermissions on the current messages"
[ root@server ~]# 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).
[ pieter@server ~]$ sudo su - iphone
Password: ****
[ iphone@server ~]$
Create the maildir structure:
[ iphone@server ~]$ maildirmake ~/Maildir
Remove the cur, new and tmp folders:
[ iphone@server ~]$ rm -rf ~/Maildir/[cnt]*
Now link them to the source:
[ iphone@server ~]$ 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
[ iphone@server ~]$ cd ~/Maildir
[ iphone@server Maildir]$ maildirmake .Archive
[ iphone@server Maildir]$ rm -rf ~/.Archive/[cnt]*
[ iphone@server 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.