writing Maildir subscriptions file outside of dovecot

Aki Tuomi aki.tuomi at open-xchange.com
Thu Oct 7 09:33:18 EEST 2021


> On 06/10/2021 22:52 David Mandelberg <david at mandelberg.org> wrote:
> 
>  
> Hi,
> 
> Is it safe to write to the Maildir subscriptions file directly?
> 
> I'm trying to figure out a way to make sure the subscriptions match the 
> actual folders exactly. I know how to subscribe to existing mailboxes 
> with `doveadm mailbox list` and `doveadm mailbox subscribe`, but the 
> latter seems to only accept mailboxes on the command line, and any local 
> user can see the command line of any other user's commands. Also, that 
> doesn't handle unsubscribing from non-existent mailboxes. I think 
> unsubscribing from any mailboxes listed in `doveadm mailbox list -s` but 
> not in `doveadm mailbox list` would work, but it has the same issue of 
> mailboxes on the command line.
> 
> It looks like I could do what I want with something like this command, 
> but I'm not sure if it's safe to write directly to the subscriptions file:
> 
> { echo INBOX; ls -1A | grep '^\.' | cut -c 2-; } > subscriptions
> 
> (I was also thinking about using `doveadm mailbox list` to write the 
> subscriptions file directly, but it looks like they use different 
> separators and encodings.)


You could also use the doveadm HTTP API to handle subscription changes? It should be safe to modify that file though, especially if the user is not logged in.

Aki


More information about the dovecot mailing list