Dovecot 2.4: shared mailboxes not working - maybe related to mail_path
Hi,
I've had a hard time trying to upgrade my dovecot 2.3 setup to v. 2.4 (debian 13, Dovecot installed from repo.dovecot.org). One thing I still haven't got to work is mailbox sharing.
I have configured this (full doveconf -n output attached):
mail_driver = mdbox mail_home = /var/spool/vmail/home/%{user | domain}/%{user | username} mail_path = /var/spool/vmail/mail/%{user | domain}/%{user | username} mail_plugins = quota acl
namespace inbox { inbox = yes separator = / }
namespace shared { mail_home = /var/spool/vmail/home/%{owner_domain}/%{owner_username} list = children prefix = shared/$domain/$username/ separator = / subscriptions = no type = shared }
acl_driver = vfile
mail_plugins { acl = yes }
protocol imap { mail_plugins { imap_acl = yes } }
acl_sharing_map { dict file { path = /var/spool/vmail/home/shared-mailboxes } }
Now, given two users: 1: sharing-user@example.com 2: sharing-client@example.net User 1 wants to share his mailbox "4you" to user 2 by setting these acls:
doveadm acl add -u sharing-user@example.com 4you user=sharing-client@example.net lookup read write-seen
But the shared mailbox isn't visible for user 2 (in fact, not even the namespace is, since list = children). acl debug shows this:
doveadm acl debug -u sharing-client@example.net shared/example.com/sharing-user/4you
doveadm(sharing-client@example.net): Error: Mailbox shared/example.com/sharing-user/4you: Mailbox '4you' in namespace shared doesn't exist in /var/spool/vmail/mail/example.net/sharing-client/mailboxes/4you/dbox-Mails
So the shared mailbox is looked for in user 2's mail_path, not in user 1's, who shares it and where the mailbox actually resides.
So, I tried and set mail_path = /var/spool/vmail/path/%{owner_domain}/%{owner_username} for the shared namespace. This does not only seem reasonable but also is mentioned in the second config example here: https://doc.dovecot.org/2.4.4/core/config/shared_mailboxes.html#user-shared-... But that doesn't help. Instead I get:
doveadm acl debug -u sharing-client@example.net shared/example.com/sharing-user/4you
doveadm(sharing-client@example.net): Error: Namespace shared: mail_storage settings: Failed to parse configuration: Failed to expand mail_path setting variables: Unknown variable 'owner_domain' doveadm(sharing-client@example.net): Error: Namespace shared: mail_storage settings: Failed to parse configuration: Failed to expand mail_path setting variables: Unknown variable 'owner_domain' doveadm(sharing-client@example.net): Error: Namespace shared: mail_storage settings: Failed to parse configuration: Failed to expand mail_path setting variables: Unknown variable 'owner_domain' doveadm(sharing-client@example.net): Error: Mailbox shared/example.com/sharing-user/4you: Can't open mailbox shared/example.com/sharing-user/4you: Internal error occurred. Refer to server log for more information. [2026-08-20 14:53:40]
Swapping %{owner_domain} and %{owner_username} in the config above, I get Unknown variable 'owner_username' as error.
If I set mail_path = /var/spool/vmail/mail/example.com/sharing-user i. e. I hard-code the sharing user's mail_path, sharing works for this particular user. But that won't help if a second user wants to share mailboxes too.
doveadm acl debug -u sharing-client@example.net shared/example.com/sharing-user/4you
doveadm(sharing-client@example.net): Info: Mailbox shared/example.com/sharing-user/4you: Mailbox '4you' is in namespace shared doveadm(sharing-client@example.net): Info: Mailbox shared/example.com/sharing-user/4you: Mailbox path: /var/spool/vmail/mail/example.com/sharing-user/mailboxes/4you/dbox-Mails doveadm(sharing-client@example.net): Info: Mailbox shared/example.com/sharing-user/4you: All message flags are shared across users in mailbox doveadm(sharing-client@example.net): Info: Mailbox shared/example.com/sharing-user/4you: User sharing-client@example.net has rights: lookup read write-seen doveadm(sharing-client@example.net): Info: Mailbox shared/example.com/sharing-user/4you: Mailbox found from dovecot-acl-list doveadm(sharing-client@example.net): Info: Mailbox shared/example.com/sharing-user/4you: User sharing-user@example.com found from ACL shared dict doveadm(sharing-client@example.net): Info: Mailbox shared/example.com/sharing-user/4you: Mailbox shared/example.com/sharing-user/4you is visible in LIST
What am I doing wrong? How to do ist right?
-- Regards mks
20.08.26, 15:39 +0200, Markus Schönhaber via dovecot:
I have configured this (full doveconf -n output attached):
The list seems to strip text attachments. Therefore the doveconf -n output inline:
2.4.4-5+debian13 (8b687aa65c): /etc/dovecot/dovecot.conf
Pigeonhole version 2.4.4-5+debian13 (3beb331a)
OS: Linux 7.1.8-1-MANJARO x86_64 Debian 13.6 btrfs
Hostname: dovecot-template
dovecot_config_version = 2.4.4 acl_driver = vfile auth_master_user_separator = * auth_mechanisms = plain login dovecot_storage_version = 2.4.4 log_debug = category=mail login_log_format_elements = user=<%{user}> method=%{mechanism} rip=%{remote_ip} lip=%{local_ip} lport=%{local_port} mpid=%{mail_pid} %{secured} mail_driver = mdbox mail_gid = vmail mail_home = /var/spool/vmail/home/%{user | domain}/%{user | username} mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename mail_log_fields = uid box msgid size mail_path = /var/spool/vmail/mail/%{user | domain}/%{user | username} mail_plugins = quota acl mail_uid = vmail postmaster_address = postmaster@example.org protocols = imap sieve sieve_global_extensions { vnd.dovecot.environment = yes vnd.dovecot.execute = yes vnd.dovecot.pipe = yes } sieve_pipe_bin_dir = /var/spool/vmail/home/3-imapsieve sieve_plugins = sieve_imapsieve sieve_extprograms sieve_redirect_envelope_from = orig_recipient sql_driver = mysql verbose_proctitle = yes mysql localhost { dbname = postfixadmin password = # hidden, use -P to show it user = postfixadmin } passdb sql { driver = sql query = SELECT mailbox.username AS user, mailbox.password AS password, CONCAT(mailbox.quota, 'B') AS userdb_quota_storage_size, 'vmail' AS userdb_uid, 'vmail' AS userdb_gid FROM mailbox INNER JOIN domain ON mailbox.domain = domain.domain WHERE mailbox.username = '%{user}' AND mailbox.active = '1' AND domain.active = '1' } userdb prefetch { driver = prefetch } userdb sql { driver = sql iterate_query = SELECT username AS user FROM mailbox WHERE active = 1 query = SELECT username AS user, 'vmail' AS uid, 'vmail' AS gid, CONCAT(quota, 'B') AS quota_storage_size FROM mailbox WHERE username = '%{user}' AND active='1' } event_exporter log { driver = log format = json time_format = rfc3339 } metric imap_id { exporter = log filter = event=imap_id_received } namespace public { mail_home = /var/spool/vmail/home/Public mail_path = /var/spool/vmail/mail/Public list = children prefix = Public/ separator = / subscriptions = no type = public } namespace shared { mail_home = /var/spool/vmail/home/%{owner_domain}/%{owner_username} list = children prefix = shared/$domain/$username/ separator = / subscriptions = no type = shared } namespace inbox { inbox = yes separator = / } service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0666 user = postfix } } ssl_server { cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem key_file = /etc/ssl/private/ssl-cert-snakeoil.key } protocol imap { mail_plugins { imap_acl = yes imap_quota = yes imap_sieve = yes } } acl_sharing_map { dict file { path = /var/spool/vmail/home/shared-mailboxes } } quota "User quota" { } dict_server { dict mysql { driver = sql sql_driver = mysql dict_map priv/quota/messages { sql_table = quota2 username_field = username dict_map_value_field messages { } } dict_map priv/quota/storage { sql_table = quota2 username_field = username dict_map_value_field bytes { } } } } quota_clone { dict proxy { name = mysql } } sieve_script personal { active_path = ~/.dovecot.sieve driver = file path = ~/sieve } sieve_script after-0 { driver = file path = /var/spool/vmail/home/1-global/sieve/after type = after } sieve_script before-0 { driver = file path = /var/spool/vmail/home/1-global/sieve/before type = before }
Hi Markus,
This ist the way I configured "shares" and it's still working: (German language)
https://dokuwiki.tachtler.net/doku.php?id=tachtler:dovecot_archlinux_-_share...
Greetings Klaus.
20.08.2026 18:55:31 Markus Schönhaber via dovecot <dovecot@dovecot.org>:
20.08.26, 15:39 +0200, Markus Schönhaber via dovecot:
I have configured this (full doveconf -n output attached):
The list seems to strip text attachments. Therefore the doveconf -n output inline:
2.4.4-5+debian13 (8b687aa65c): /etc/dovecot/dovecot.conf
Pigeonhole version 2.4.4-5+debian13 (3beb331a)
OS: Linux 7.1.8-1-MANJARO x86_64 Debian 13.6 btrfs
Hostname: dovecot-template
dovecot_config_version = 2.4.4 acl_driver = vfile auth_master_user_separator = * auth_mechanisms = plain login dovecot_storage_version = 2.4.4 log_debug = category=mail login_log_format_elements = user=<%{user}> method=%{mechanism} rip=%{remote_ip} lip=%{local_ip} lport=%{local_port} mpid=%{mail_pid} %{secured} mail_driver = mdbox mail_gid = vmail mail_home = /var/spool/vmail/home/%{user | domain}/%{user | username} mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename mail_log_fields = uid box msgid size mail_path = /var/spool/vmail/mail/%{user | domain}/%{user | username} mail_plugins = quota acl mail_uid = vmail postmaster_address = postmaster@example.org protocols = imap sieve sieve_global_extensions { vnd.dovecot.environment = yes vnd.dovecot.execute = yes vnd.dovecot.pipe = yes } sieve_pipe_bin_dir = /var/spool/vmail/home/3-imapsieve sieve_plugins = sieve_imapsieve sieve_extprograms sieve_redirect_envelope_from = orig_recipient sql_driver = mysql verbose_proctitle = yes mysql localhost { dbname = postfixadmin password = # hidden, use -P to show it user = postfixadmin } passdb sql { driver = sql query = SELECT mailbox.username AS user, mailbox.password AS password, CONCAT(mailbox.quota, 'B') AS userdb_quota_storage_size, 'vmail' AS userdb_uid, 'vmail' AS userdb_gid FROM mailbox INNER JOIN domain ON mailbox.domain = domain.domain WHERE mailbox.username = '%{user}' AND mailbox.active = '1' AND domain.active = '1' } userdb prefetch { driver = prefetch } userdb sql { driver = sql iterate_query = SELECT username AS user FROM mailbox WHERE active = 1 query = SELECT username AS user, 'vmail' AS uid, 'vmail' AS gid, CONCAT(quota, 'B') AS quota_storage_size FROM mailbox WHERE username = '%{user}' AND active='1' } event_exporter log { driver = log format = json time_format = rfc3339 } metric imap_id { exporter = log filter = event=imap_id_received } namespace public { mail_home = /var/spool/vmail/home/Public mail_path = /var/spool/vmail/mail/Public list = children prefix = Public/ separator = / subscriptions = no type = public } namespace shared { mail_home = /var/spool/vmail/home/%{owner_domain}/%{owner_username} list = children prefix = shared/$domain/$username/ separator = / subscriptions = no type = shared } namespace inbox { inbox = yes separator = / } service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0666 user = postfix } } ssl_server { cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem key_file = /etc/ssl/private/ssl-cert-snakeoil.key } protocol imap { mail_plugins { imap_acl = yes imap_quota = yes imap_sieve = yes } } acl_sharing_map { dict file { path = /var/spool/vmail/home/shared-mailboxes } } quota "User quota" { } dict_server { dict mysql { driver = sql sql_driver = mysql dict_map priv/quota/messages { sql_table = quota2 username_field = username dict_map_value_field messages { } } dict_map priv/quota/storage { sql_table = quota2 username_field = username dict_map_value_field bytes { } } } } quota_clone { dict proxy { name = mysql } } sieve_script personal { active_path = ~/.dovecot.sieve driver = file path = ~/sieve } sieve_script after-0 { driver = file path = /var/spool/vmail/home/1-global/sieve/after type = after } sieve_script before-0 { driver = file path = /var/spool/vmail/home/1-global/sieve/before type = before }
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
--
e-Mail : klaus@tachtler.net Homepage: https://www.tachtler.net DokuWiki: https://dokuwiki.tachtler.net
participants (2)
-
Klaus Tachtler
-
Markus Schönhaber