What would be the best way to do this migration considering that I do not have the passwords for the IMAP accounts on the source server running FreeBSD and Dovecot. I do have SSH access to both servers.

Also although both servers use Dovecot on the source the directory structure is a bit different "/home/account/Maildir" and on the new server it is "/home/account/mail/domain/useraccount/"

I do not have experience on how the FreeBSD email configuration was made and I would like to know what would be the best way to migrate them without loosing the UIDs.

Thank you

  • Yes, I have tried through scp and it seems to be working fine. Thank you. – Valentin G. Feb 23 '15 at 22:01

Dovecot allows you to configure a master user which can be used to access user mailboxes without knowing their passwords. The master user can be used with imapsync (as well as most other IMAP tools) to copy the messages between servers.

From the dovecot configuration file on my server:

By adding master=yes setting inside a passdb you make the passdb a list of "master users", who can log in as anyone else.

For example:

passdb passwd-file  {

I'm running a rather old version of Dovecot so you may need to do it differently on your server.

  • Where is the advantage over using scp? It's a nice method, but I need to setup the master and then call imapsync for all users. It's independent of the underlying format though. – sebix Feb 24 '15 at 15:02
  • In your case, scp is easier than imapsync since you are copying from Dovecot to Dovecot. What I described is a more generic solution where the target does not have the same architecture as the source. – Rick Sanders Feb 24 '15 at 15:45

When both mail servers use the same mail format (mbox, Maildir, MBX), the simplest solution is to just copy over the directory structures containing the mails, e.g. using scp. This also preserves the Message-IDs, as opposed to tools like doveadm copy.

Another possibility is to use the IMAP-protocol itself for IMAP copying using tools like imapsync. But in this case you need the login credentials which you shouldn't have as admin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.