0 votes
I'm setting up a clean community version of ClearOS 7 system for migrating my current ClearOS 6. I mainly use it as mailserver for home use.
I installed the paid marketplace Roundcube version on ClearOS 7, added a user and used imapsync for copying the mail of this user from ClearOS 6 to ClearOS 7. All working fine.
As I was not happy with the new folderstructure in Roundcube/IMAP I deleted the user using the webconfig and added the same user again. My intention was getting a clean user again. However I discovered when I logged on into Rouncube after re-adding the user the old mails still existed. Apparently a "Delete User" does not delete its user data. I suppose that is intentionally but not working for my case.
Question: how can I remove the old user data? In my case the mail history and mail folder structure is sufficient. Just manually deleting the user (after deleting the user in the webconfig) in the /var/spool/imap and adding the same user again in the webconfig results in a "Server Error: Status: System I/O error" logging on into Roundcube and even still seeing the old imap folder structure.
In Users
Monday, February 04 2019, 02:19 PM
Share this post:
Responses (2)
  • Accepted Answer

    Tuesday, February 05 2019, 03:48 PM - #Permalink
    0 votes
    Thanks Nick. After deleting user1 using the ClearOS webconfig I could easily remove the mailbox using cyradm (I have root access in ClearOS7)
    sam user/user1 root all
    dm user/user1

    After that I can add user1 again in ClearOS webconfig and have a clean mailbox.

    As I had messed up one user by deleting a user folder manually (after neatly deleting this user in ClearOS webconfig) in /var/spool/imap/../user and later in /var/lib/imap/user, even using reconstruct in cyradmin didn't work ("System I/O error").
    I discovered /var/lib/imap/mailboxes.db still contained the manually deleted user. Converting it to flat file, remove the user and converting it back solved this issue too:

    service cyrus-imapd stop
    # convert cyrus mailboxes.db to flat file
    /usr/lib/cyrus-imapd/cvt_cyrusdb /var/lib/imap/mailboxes.db skiplist /root/tmp/mailboxes.db.txt flat
    # now delete unwanted users flat file
    # and convert back to cyrus mailboxes,db
    /usr/lib/cyrus-imapd/cvt_cyrusdb /root/tmp/mailboxes.db.txt flat /root/tmp/ skiplist
    # copy back
    cp /root/tmp/ /var/lib/imap/mailboxes.db
    chown cyrus:mail /var/lib/imap/mailboxes.db
    chmod 600 /var/lib/imap/mailboxes.db
    # delete user folders from /var/lib/imap/user and /var/spool/imap
    # reconstruct
    service cyrus-imapd start
    The reply is currently minimized Show
  • Accepted Answer

    Monday, February 04 2019, 03:15 PM - #Permalink
    0 votes
    Emails go into two folder structures, one under /var/spool/imap and one under /var/lib/imap and one is a cache. You could try running /usr/lib/cyrus-imapd/reconstruct from the command line to do a repair.

    Mailboxes can be deleted with the cyradm utility, but, as admin user, I think you have to take ownership first. you should be able to go in as root user with the root password if root is listed in /etc/clearos/imap.d/authorize (add it if not there, but make sure you have a <cr> at the end of the line) or the clearos-imap-admin user with the password in /etc/clearos/imap.d/admin_password.conf. User mailboxes are in the form user/nick and not user.nick as you'll see in a lot of examples.
    The reply is currently minimized Show
Your Reply