...because I noticed back when we had used imap a lot (before going to POP3 and just downloading the emails off the server on the respective PC) that there are some users with some pretty large email folders in /var/spool/imap that should no longer be there. I've never used imap on my account, and my folder just has 4 cyrus.* files in it. I still use imap on my iPod for example and those emails get cleared out nicely once I start up the PC.

All of the emails are safe on the respective computer, so I followed the instructions above and logged in fine as root. I figured that I could just 'dm/cm' to the correct user/username mailbox, but it tells me 'permission denied' as root. Per the link above, I also checked /etc/clearos/imap.d/authorize (Peter's post #54099) and root is there. Editing /etc/pam.d/imap was done as well and I restarted the service.

Is there a better way to refresh (clean out) this imap folder than what I'm doing? If I delete the user folder or try and trick it by 'touch'ing new files with the same username and permissions, that doesn't work either.

P.S. My plan was to open up the email quickly on the POP3 PC so it downloads the emails off the server and then refresh the imap user folder.

Accepted Answer

Thanks, I'll give this another look maybe tomorrow or Wednesday. We've been out of power here now for a little over an hour, and my Internet will eventually give up even if the batteries make it.

Anyway, for the POP setup we have use, the PC downloads the emails from the server and then deletes them. If someone uses a smart phone or tablet, that uses IMAP and the email stays on the server until the PC gets to download it.

It may come down to researching this a bit more as you've said; I'll experiment more when the countdown clock isn't ticking.

Accepted Answer

# this is only necessary if using duplicate delivery suppression
delprune cmd="ctl_deliver -E 3" period=1440

# this is only necessary if caching TLS sessions
tlsprune cmd="tls_prune" period=1440

delprune cmd="cyr_expire -E 1 -X 7" at=0001
}

rather than a change.

Looking through my logs I see events at 00:01 which seem to do a lot of purging. I also see some at 03.?? (which is cron.daily) also purging a bit so they are both doing some work.

Try them both. They won't harm, but I would have thought running cyr_expire manually would have done something if either of these are going to work. You may need to research a bit more as I use IMAP and not POP so I don't know if POP behaves differently. Is the POP client set up to Delete from Server or just Mark as Read but only download Unread messages?

On my client I (Thunderbird) also have the option to trigger an expunge when exiting which I have set.

Accepted Answer

Ok, just to see what would happen with cyr_expire I tried your first command manually:

./cyr_expire -E 1s -X 1s

And it ran fine, but didn't seem to give any additional space back in the 'df' command. In /etc/cyrus.conf, here's the default EVENTS subroutine:

EVENTS {
# this is required
checkpoint cmd="ctl_cyrusdb -c" period=30

# this is only necessary if using duplicate delivery suppression
delprune cmd="ctl_deliver -E 3" period=1440

# this is only necessary if caching TLS sessions
tlsprune cmd="tls_prune" period=1440
}

...so by default, delprune is set to run "ctl_deliver" instead of "cyr_expire" apparently.

Do you think i should just try your /etc/impad.conf addition, /etc/cron.daily addition, and modify (comment out the old) delprune command in /etc/cyrus.conf to see if this changes anything? Or, should running cyr_expire manually have done something to free up space if it were going to?

Accepted Answer

Hi Nick and thanks for the two posts; I've been busy tonight and haven't had a chance to look at your suggestions in depth yet. I'll undo what I did yesterday from the older post and will look into your commands tomorrow. I had the same feeling that there must be a 'expunging' type command to clean things up and when I didn't find anything, went with the remove and replace the mailbox idea. I'll reply back here what happens afterwards.

Accepted Answer

You should not need the older post as that issue was fixed a while ago and no edt of /etc/pam.d/imap should be needed. The problem is in cyradm and google will be your friend here. Start with this link and note what it says about the dm command and setaclmailbox. From memory, that is the start and there is one other access right you may need but it is a long time since I tried deleting a user so I can't remember exactly what I did.

One issue I had with Cyrus is that it was not expunging deleted e-mails. have a look at the cyr_expire command. Also look at the delprune command. I'll have to have a look at what I did when I get home. I think I've put one in a nightly script and the other in imapd.conf as "belt and braces"

I have a feeling you'll want to try expunging messages rather than delete and recreate the mailboxes.