Creating Dovecot Master users/passwords doesn't work

I've been cracking my head on this for hours. I want to create a master user that has access to all dovecot accounts. I've followed the tutorial on dovecot website, however, it still it either says "Authentication failed" or "Waiting for authentication process to respond" and it never works. What could I possibly be doing wrong here? Thanks

//dovecot.conf

# 2.0.16: /usr/local/etc/dovecot/dovecot.conf
# OS: FreeBSD 8.2-RELEASE amd64  
auth_master_user_separator = *
disable_plaintext_auth = no
mail_location = maildir:~/Maildir
namespace {
  inbox = yes
  location = 
  prefix = INBOX.
  separator = .
  type = private
}

passdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf
  driver = sql
}
passdb {
  args = /usr/local/etc/dovecot/passwd.master
  driver = passwd-file
  master = yes
}
protocols = imap pop3
service auth {
  client_limit = 6000
}
service imap {
  process_limit = 2048
  vsz_limit = 1256 M
}
service pop3 {
  process_limit = 2048
}

userdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf
  driver = sql
}
userdb {
  driver = passwd
}
protocol pop3 {
  pop3_uidl_format = UID%u-%v
}
    --> as instructed from http://wiki.dovecot.org/Authentication/MasterUsers

cat passwd.master

master:{SHA}E9RIKlmYWisBS3ObR16GwKUZNZg=  

telnet localhost 143

 Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    a login loginuser*master mypassword
    * OK Waiting for authentication process to respond..
    * OK Waiting for authentication process to respond..                                                                                                                   
    * BYE Disconnected for inactivity.                                                                                                                                     
    Connection closed by foreign host.

or

telnet localhost 143                                                                                                         
Trying 127.0.0.1...                                                                                                                                                    
Connected to localhost.                                                                                                                                                
Escape character is '^]'.                                                                                                                                              
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN                                                
1 login loginuser*master mypassword                                                                                                                      
1 NO [AUTHENTICATIONFAILED] Authentication failed.                                                                                                                     
* BYE Disconnected for inactivity.                                                                                                                                     
Connection closed by foreign host.  

//dovecot -n

# 2.0.16: /usr/local/etc/dovecot/dovecot.conf
# OS: FreeBSD 8.2-RELEASE amd64  
auth_master_user_separator = *
disable_plaintext_auth = no
login_greeting = CFI mail server ready.
mail_location = maildir:~/Maildir
namespace {
  inbox = yes
  location = 
  prefix = INBOX.
  separator = .
  type = private
}

passdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf
  driver = sql
}
passdb {
  args = /usr/local/etc/dovecot/passwd.master
  driver = passwd-file
  master = yes
}
protocols = imap pop3
service auth {
  client_limit = 6000
}
service imap {
  process_limit = 2048
  vsz_limit = 1256 M
}
service pop3 {
  process_limit = 2048
}

userdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf
  driver = sql
}
userdb {
  driver = passwd
}
protocol pop3 {
  pop3_uidl_format = UID%u-%v
}

Solution 1:

Finally got it work! First, I had to auth_master_user_separator = + instead of with *. This removed the complaint from dovecot that Username character disallowed by auth_username_chars: 0x2a (username: loginuser*master)

Then realized I was adding master password records using the htpasswd command to the wrong file /usr/local/etc/dovecot/dovecot.master yet in my configs it the right file is /usr/local/etc/dovecot/passwd.master. I don’t know how i failed to see that quickly.

Lastly I wasn’t testing the master user logins well using telnet. I was using 1 login loginuser+master mypassword instead of 1 login [email protected]+master mypassword

Lastly my configs in dovecot.conf look something like

auth_master_user_separator = +                                                                                                                            
#auth_username_chars = *  #dovecot complains about the “*” character                                                                                                                               
auth_verbose = yes                                                                                                                                             
auth_debug = yes                                                                                                                                               
auth_debug_passwords = yes                                                                                                                                     
passdb {                                                                                                                                                       
        driver = passwd-file                                                                                                                                   
        args = /usr/local/etc/dovecot/passwd.master                                                                                                            
        master = yes                                                                                                                                           
        #pass = yes                                                                                                                                            

}                                                                                                                                                              
passdb {                                                                                                                                          
        #driver = shadow                                                                                                                                       
        driver = pam                                                                                                                                           
}                                                                                                                                                              
userdb {                                                                                                                                                       
  driver = passwd                                                                                                                                              
}