Dovecot provides a master login (a master user name and password that can log into all user accounts).

I've setup Dovecot as per: http://wiki1.dovecot.org/Authentication/MasterUsers

Here's my problem.

The only way I can authenticate successfully is if I try to authenticate through telnet twice.

$ telnet mail01.server.com 143
Connected to mail01.server.com.
Escape character is '^]'.
* OK Dovecot ready.
1 login [email protected]*master my_password
1 NO Authentication failed.
1 login [email protected]*master my_password
1 OK Logged in.

imapsync (the tool I need to use to migrate over emails from Dovecot to Zimbra) won't work.

    $ imapsync --nosyncacls --syncinternaldates --host1 mail01.server.com --user1 [email protected]*master --authmech1 PLAIN --password1 my_password --host2 mail02.server.com --user2 [email protected] --authmech2 PLAIN --ssl2 --password2 user2_password
$RCSfile: imapsync,v $ $Revision: 1.286 $ $Date: 2009/07/24 15:53:04 $ 
Here is a [linux] system (Linux mylinuxbox 2.6.32-30-generic #59-Ubuntu SMP Tue Mar 1 21:30:21 UTC 2011 i686)
with perl 5.10.1
Mail::IMAPClient  3.21
IO::Socket        1.31
Digest::MD5       2.39
Term::ReadKey     2.30
 and the module Mail::IMAPClient version used here is 3.21
Command line used:
/usr/bin/imapsync --nosyncacls --syncinternaldates --host1 mail01.server.com --user1 user@server*master --authmech1 PLAIN --password1 MASKED --host2 mail02.server.com --user2 [email protected] --authmech2 PLAIN --ssl2 --password2 MASKED
Turned ON syncinternaldates, will set the internal dates (arrival dates) on host2 same as host1.
Will try to use PLAIN authentication on host1
Will try to use PLAIN authentication on host2
From imap server [mail01.server.com] port [143] user [[email protected]*master]
To   imap server [mail02.server.com] port [993] user [[email protected]]
Banner: * OK Dovecot ready.
Host mail01.server.com says it has CAPABILITY for AUTHENTICATE PLAIN
Error login: [mail01.server.com] with user [user@server*master] auth [PLAIN]: 2 NO Authentication failed.
Error login: [mail01.server.com] with user [user@server*master] auth [PLAIN]: 2 NO Authentication failed.

If I try without the master user it works. Please help.

  • When you created everyone's Zimbra accounts, where did you get their passwords from? Can you use those? Can you change people's passwords before you migrate their email?
    – Andrew
    Apr 27, 2011 at 5:14
  • @Andrew I can't use those passwords. The point of the master login is to bypass everyone's password and use one master password. I cannot change everyone's password before they migrate because they'll still have access to the old system. My problem has nothing to do with user passwords but with the dovecot master authentication.
    – hfranco
    Apr 27, 2011 at 23:45
  • From the page you linked to: "If you had any problems, set auth_debug=yes and look at the logs." - Anything in the logs?
    – rthomson
    May 1, 2011 at 6:26
  • You've messed something up. The master login doesn't require you log in twice. Perhaps you forgot to add pass=yes to the master passdb section? Or perhaps your checkpassword tool is configured wrong? Perhaps tracing the authentication process will help.
    – geocar
    May 1, 2011 at 12:41

3 Answers 3


The imapsync --authuser1 option explained by Jazzy Pierre may solve your issue. Have a try.

(I wrote imapsync).


I've successfully used imapsync to migrate from dovecot to zimbra using a master password. I did change the master user separator from * to +, because the * causes the shell to process it as a wildcard.

Find this line in your dovecot.conf and change it to read:

auth_master_user_separator = +

Here's the command I typically use:

/usr/bin/imapsync \
 --host1 $DOVECOTHOST --user1 "${USER}+mail-admin" --passfile1 /root/.dovecot-master \
 --host2 $ZIMBRAHOST  --user2  $ZMUSER --passfile2 $ZMPASS \
 --authmech1 PLAIN --authmech2 PLAIN \
 --exclude Trash --subscribe --syncinternaldates

Hope that helps.


Have you looked at the mail migration page on Zimbra's wiki? There are scripts for importing directly from mbox or maildir mail stores into Zimbra. That strategy may be faster and simpler than using imapsync.

If you do need to use imapsync, I second the comment about the Dovecot auth logs. Something is clearly going wrong with the master password authentication. What version of Dovecot are you using? Could you post the relevant parts of your Dovecot configuration?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .