Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a working courier-imap server on my Debian Etch private server ; users are virtual, authentificatin goes through mysql. It's been working good for years.

I would like to share an imap folder between 2 users.

I thought I would just have to do something like this :

cd path/to/mailusers/dir
ln -s path/to/user1/maildir/.folder_to_be_synched path/to/user2/maildir/

After I entered the command, I found that user2 saw a new folder in its imap client, but the folder appeared empty.

It is not a permission problem because all the virtual users have the same permissions on the file system.

Any idea what I could do ?


share|improve this question

You might need to setup IMAP ACLs using the maildiracl command. Since you're using a virtual setup, these are how Courier enforces access control. These ACLs are stored in the courierimapacl file and the syntax is described in the maildiracl man page. For example, you can use this syntax to give another user read access to a folder:

maildiracl -set /somedirectorypath/user/Maildir/ INBOX user=otheruser lr

share|improve this answer

Here's what worked for me :

1.create the index file in /etc/courier/shared.tmp/index sharedindexinstall without any arguments this will generate /etc/courier/shared/index out of /etc/courier/shared.tmp/index you created earlier.

3.give the necessary rights and permissions on the desired folder (or inbox) to the desired user (or users)

4.If you are using roundcube as a webmail don't forget to add this to your configuration file (usually that's /var/www/whereroundcubeis/config/

$config['imap_force_ns'] = true;

Now I will go into the details of steps 1 and 3

1.create the index file in /etc/courier/shared.tmp/index

Courier's documentation specifies that the last field should be the maildir path relative to the home field (second to last). So the right format should have been :

root@messagerie-secours[] ~ # cat /etc/courier/shared/index
ali.mellah@xxx    5000    5000    /var/vmail/xxx/      ali.mellah
a.chaouche@xxx    5000    5000    /var/vmail/xxx/      a.chaouche
root@messagerie-secours[] ~ # 

The format is :

  userid \t uid \t gid \t homedir \t maildir 

userid : this should be the same id you find in the syslog or mail.log (/var/log/mail.log) in the IMAP login messages.
uid/gid : this should be the uid and gid of the system user. If you are in a virtual setup, all the IMAP users should have the same system username (vmail in my case) thus having the same uid and gid (vmail in my case has uid 5000 and gid 5000)
homeidr : this is the home directory of the user. In my case, they all share the same homedir, only the maildirs are different.
maildir : this should be a relative path to homedir, not a full path. If you do a full path courier will fail and log a line in /var/log/mail.err or /var/log/mail.warn

The fields are separated by tabs.

3. Set the necessary rights on individual folders

  maildiracl -set /var/vmail/xxx/a.chaouche/ "INBOX.PRTG" user=ali.mellah@xxx lr

Giving ali.mellah@xxx the right to list and read the content of the INBOX.PRTG folder inside a.chaouche@xxx mailbox.

You can see the rights of all users of a folder or inbox with maildiracl -list, like this :

root@messagerie-secours[] ~ # maildiracl -list /var/vmail/ "INBOX.PRTG" 
owner   aceilrstwx
administrators  aceilrstwx    lr       lr
root@messagerie-secours[] ~ #

You can see the rights of a specific user on a folder with maildiracl -compute, like this :

root@messagerie-secours[] /home/serveur # maildiracl -compute /var/vmail/ "INBOX.Flux audio"
root@messagerie-secours[] /home/serveur # 

From :

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.