Ask AFP548 January 28, 2006 at 9:30 pm

How to Delete Old User Mailboxes

We have quite a large turnover of staff, and over a period of time I noticed that once users accounts were deleted in WGM, (and indeed none functional), their mailboxes were still present and showing up in SA.

There is a how-to floating about (url below) which will kill these mailboxes, but it seems it only works prior to deleting user in WGM.

Anyone any ideas?

How-to url: http://downloads.topicdesk.com/delete_mail_users.pdf

This how-to is accurate overall, but there are a few nuances that you might be missing that aren’t explicitly spelled out in the paper.

Read on for the solution…
Like I said, there is nothing wrong with the topicdesk how-to, but you might be missing a key point in how to escape your paths in cyradm. I have quite a few orphaned mailboxes on my server after I was working on a few articles. I removed all my test users, but didn’t delete the mailboxes and they show up in Server Admin. Let’s delete one together…

First I need to login to cyradm with an IMAP admin user. These users are defined in a comma delimited list in /etc/imapd.conf. Logging in is easy to do, ssh into the server and do

/usr/bin/cyrus/admin/cyradm -u mailadmin localhost

Enter your password and you should be delivered to a localhost prompt.

Now take a look at the mailboxes with lm. In my case I see the box I want to delete listed as

Other Users/p10002 (HasNoChildern)

Next we need to give our mailadmin user full control of the mailbox, otherwise we won’t be able to delete it. To do this we need to add an ACL to the mailbox with

sam Other\ Users/p10002 mailadmin all

Note that you must escape your paths in cyradm!

Now we can delete the mailbox with

dm Other\ Users/p10002

Exit out of cyradm and click refresh in Server Admin. You should see the user’s box disappear from the list in the Accounts tab.

The part that most people miss is that you need to escape the paths in cyradm. Give it a try and let us know in the comments below if you had any luck.

As always, read the man pages and have fun!

man cyradm

No Comments

  • Still having a problem here, am I missing somethig?

    When I lm (list mailboxes) i only see:
    Deleted Messages (\HasNoChildren) INBOX (\Noinferiors)
    Drafts (\HasNoChildren) Sent Messages (\HasNoChildren)

    Not sure what I am seeing at this point, expected a list of users mailboxes.

    I am new to this sort of thing . . . and I would appreciate a little more help
    with this.

    many thanks

    • Who are you logging into the server with cyradm as? Were you sure to add the
      user to the admin list in /etc/imapd.conf?


      Breaking my server to save yours.

      Josh Wisenbaker
      http://www.afp548.com

      • Hi macshome

        I have entered an admin user (mail enabled) into /etc/imapd.conf and used
        this to log on to crdram, I can’t see any deviation from your process here. . .
        but must have something wrong. ironic after all the problems with mail
        services in 10.3, its great to have the filters, spam,virus scanning etc all
        working. but get stuck with these mail boxes.

        I don’t know if its relevent, but one of these users (collect allmail) had a 2 gig
        mail quota which overflowed, could not clear this, so I deleted the user and
        reset the account with a different name. (this acount was supposed to have
        been automatically deleted but ran on unchecked.)

        snafu

    • I get the same thing when I log in type lm:

      When I lm (list mailboxes) i only see:
      Deleted Messages (\HasNoChildren) INBOX (\Noinferiors)
      Drafts (\HasNoChildren) Sent Messages (\HasNoChildren)

      The user I have is mailadmin and is in /etc/imapd.conf. I don’t understand
      what’s going on.

      Scott

      • Figure out the issue that was going on in the admins list in /etc/imapd.conf, the
        admins must have a space between them so, admins: cryrusimap mailadmin or
        admins: cyrusimap, mailadmin, if you have admins: cyrusimap,mailadmin with
        not space then you just get mailbox, but if you have the spaces separating
        admins then you get list of mailboxes when using lm.

        • Also after adding mail admin user, stop and restart mail service, to make sure
          admin user it picked up.

  • Oh thankyou for that . . .

Leave a reply

You must be logged in to post a comment.