writing Maildir subscriptions file outside of dovecot

David Mandelberg david at mandelberg.org
Wed Oct 6 22:52:48 EEST 2021


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.)

More information about the dovecot mailing list