Dovecot has hardcoded root prevention. For delivery, too.

---
Aki Tuomi
Dovecot oy

-------- Original message --------
From: "@lbutlr" <kremels@kreme.com>
Date: 04/05/2018 15:24 (GMT+02:00)
To: dovecot <dovecot@dovecot.org>
Subject: expiring mail from root's Maildirs?

I would like to delete old mail from root's sent mailbox but doveadm throws errors when I try to do this, not wanting to process root's mail at all (I am running the commands as root, naturally)

# doveadm expunge -u root mailbox Sent SENTBEFORE 1-Apr-2018
doveadm(root): Error: Invalid settings in userdb: userdb returned 0 as uid
doveadm(root): Error: User lookup failed: Invalid user settings. Refer to server log for more information.

The error makes me think this is intentional, and I can see that makes a sort of sense, but it still leaves me with a Sent box that grow forever until I manually go in and remove old mails.

I am using passed for userdb and pam for passdb:

passdb {
  username_filter = "!*@*"
  driver = pam
}
userdb {
  driver = passwd
}

Can I do this with doveadm or am  going to have to resort to either manually removing the mail (hah!) or just crontabbing a task to remove the files more than 30 days old?