<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Im having issues login to dovecot using imap through telnet.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255)">
Im running<span> </span><code style="margin: 0px; padding: 1px 5px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; background-color: rgb(239, 240, 241)">Linux
 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u1 (2019-09-20) x86_64 GNU/Linux</code></p>
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255)">
Im totally new to setting up mailservers. I havesetup a postfix for SMTP and it can receive emails. Postfix version is<span> </span><code style="margin: 0px; padding: 1px 5px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; background-color: rgb(239, 240, 241)">mail_version
 = 3.1.12</code></p>
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255)">
I have also installed Dovecot version:<code style="margin: 0px; padding: 1px 5px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; background-color: rgb(239, 240, 241)">2.2.27
 (c0f36b0)</code><span> </span>My configuration is such that POSTFIX is configured to use DOVECOT SASL through local socket.</p>
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255)">
My system is configured to store emails in<span> </span><code style="margin: 0px; padding: 1px 5px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; background-color: rgb(239, 240, 241)">/var/mail/owndomain.org/<username></code>.
 For each domain i have my own passwd file where dovecot is supposed to lookup usernames and passwords.<span> </span><code style="margin: 0px; padding: 1px 5px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; background-color: rgb(239, 240, 241)">/var/mail/owndomain.org/passwd</code>.</p>
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255)">
I have created<span> </span><code style="margin: 0px; padding: 1px 5px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; background-color: rgb(239, 240, 241)">virtualuser</code><span> </span>for
 accessing mails and authenticating users. My dovecot (dovecot -n output) configuration is:</p>
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255)">
-------------------------------------------------------------</p>
<div style="margin: 0px 0px 15px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255);">
<span># 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf<br>
</span>
<div># Pigeonhole version 0.4.16 (fed8554)<br>
</div>
<div># OS: Linux 4.9.0-11-amd64 x86_64 Debian 9.11 <br>
</div>
<div>auth_debug = yes<br>
</div>
<div>auth_mechanisms = plain login<br>
</div>
<div>auth_verbose = yes<br>
</div>
<div>debug_log_path = /var/log/dovecot-debug.log<br>
</div>
<div>disable_plaintext_auth = no<br>
</div>
<div>info_log_path = /var/log/dovecot-info.log<br>
</div>
<div>listen = 192.168.2.2<br>
</div>
<div>log_path = /var/log/dovecot.log<br>
</div>
<div>mail_home = /var/mail/home/%d/%n<br>
</div>
<div>mail_location = mbox:~/mail:INBOX=/var/spool/mail/%d/%n<br>
</div>
<div>mail_privileged_group = virtualmail<br>
</div>
<div>namespace inbox {<br>
</div>
<div>  inbox = yes<br>
</div>
<div>  location = <br>
</div>
<div>  mailbox Drafts {<br>
</div>
<div>    special_use = \Drafts<br>
</div>
<div>  }<br>
</div>
<div>  mailbox Junk {<br>
</div>
<div>    special_use = \Junk<br>
</div>
<div>  }<br>
</div>
<div>  mailbox Sent {<br>
</div>
<div>    special_use = \Sent<br>
</div>
<div>  }<br>
</div>
<div>  mailbox "Sent Messages" {<br>
</div>
<div>    special_use = \Sent<br>
</div>
<div>  }<br>
</div>
<div>  mailbox Trash {<br>
</div>
<div>    special_use = \Trash<br>
</div>
<div>  }<br>
</div>
<div>  prefix = <br>
</div>
<div>}<br>
</div>
<div>passdb {<br>
</div>
<div>  driver = pam<br>
</div>
<div>}<br>
</div>
<div>passdb {<br>
</div>
<div>  args = username_format=%n /var/mail/%d/passwd<br>
</div>
<div>  driver = passwd-file<br>
</div>
<div>}<br>
</div>
<div>pop3_uidl_format = %g<br>
</div>
<div>protocols = imap pop3<br>
</div>
<div>service auth {<br>
</div>
<div>  unix_listener /var/spool/postfix/private/auth {<br>
</div>
<div>    group = postfix<br>
</div>
<div>    mode = 0660<br>
</div>
<div>    user = postfix<br>
</div>
<div>  }<br>
</div>
<div>  user = dovecot<br>
</div>
<div>}<br>
</div>
<div>ssl = no<br>
</div>
<div>userdb {<br>
</div>
<div>  driver = passwd<br>
</div>
<div>}<br>
</div>
<div>userdb {<br>
</div>
<div>  args = username_format=%n /var/mail/%d/passwd<br>
</div>
<div>  default_fields = uid=virtualmail gid=virtualmail home=/var/mail/%d/%n<br>
</div>
<div>  driver = passwd-file<br>
</div>
<div>}<br>
</div>
<span>verbose_proctitle = yes</span></div>
<div style="margin: 0px 0px 15px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255);">
<span>----------------------------------------</span></div>
<div style="margin: 0px 0px 15px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255);">
<span>
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; clear: both; background-color: rgb(255, 255, 255)">
<strong style="margin: 0px; font-weight: bold">Now the problem:</strong><span> </span>I was testing the configuration using telnet. POSTFIX receives email, stores it. No problem. When i tried to log in onto Dovecot IMAP using Telnet i get this message:</p>
<pre style="margin: 0px 0px 1em; padding: 12px 8px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); border-radius: 3px"><code style="margin: 0px; background-color: rgb(239, 240, 241)">* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH-LOGIN] Dovecot ready.
a login "username@owndomain.org" "test"
a NO [UNAVAILABLE] Internal error occured. Refer to server log for more information.
</code></pre>
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; clear: both; background-color: rgb(255, 255, 255)">
I have enabled verbose logging and this is the output of logs:<span> </span><code style="margin: 0px; padding: 1px 5px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; background-color: rgb(239, 240, 241)">/var/log/dovecot.log</code><span> </span>had
 this message:</p>
<pre style="margin: 0px 0px 1em; padding: 12px 8px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); border-radius: 3px"><code style="margin: 0px; background-color: rgb(239, 240, 241)">Nov 16 14:20:49 auth: Error: plain(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): user not found from any userdbs
Nov 16 14:20:49 imap: Error: Authenticated user not found from userdb, auth lookup id=684589057 (client-pid=9601 client-id=1)
</code></pre>
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; clear: both; background-color: rgb(255, 255, 255)">
<code style="margin: 0px; padding: 1px 5px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; background-color: rgb(239, 240, 241)">/var/log/dovecot-debug.log</code><span> </span>had
 this message:</p>
<pre style="margin: 0px 0px 1em; padding: 12px 8px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); border-radius: 3px"><code style="margin: 0px; background-color: rgb(239, 240, 241)">Nov 16 14:20:18 auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Nov 16 14:20:18 auth: Debug: Read auth token secret from /var/run/dovecot/auth-token-secret.dat
Nov 16 14:20:18 auth: Debug: auth client connected (pid=9601)
Nov 16 14:20:47 auth: Debug: client in: AUTH    1       PLAIN   service=imap    session=RF4llXaXisPAqAmD        lip=192.168.2.2 rip=192.168.9.131       lport=143       rport=$
Nov 16 14:20:47 auth-worker(9603): Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Nov 16 14:20:47 auth-worker(9603): Debug: pam(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): lookup service=dovecot
Nov 16 14:20:47 auth-worker(9603): Debug: pam(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): #1/1 style=1 msg=Password:
Nov 16 14:20:49 auth: Debug: passwd-file /var/mail/owndomain.org/passwd: Read 2 users in 0 secs
Nov 16 14:20:49 auth: Debug: passwd-file(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): lookup: user=username file=/var/mail/owndomain.org/passwd
Nov 16 14:20:49 auth: Debug: client passdb out: OK      1       user=username@owndomain.org
Nov 16 14:20:49 auth: Debug: master in: REQUEST 684589057       9601    1       a61dd67ee43390596ddf86e6c08db6f9        session_pid=9604        request_auth_token
Nov 16 14:20:49 auth-worker(9603): Debug: passwd(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): lookup
Nov 16 14:20:49 auth: Debug: passwd-file(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): lookup: user=username file=/var/mail/owndomain.org/passwd
Nov 16 14:20:49 auth: Debug: master userdb out: NOTFOUND        684589057
</code></pre>
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; clear: both; background-color: rgb(255, 255, 255)">
And i am completelly clueless what is the problem. Because it seems as if the password was found but the user is not? Password and user are looked up in the same passwd file. Have i forgotten something to setup? Any help or guidance is appreciated!</p>
<p style="margin: 0px 0px 1em; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; clear: both; background-color: rgb(255, 255, 255)">
I have also posted the issue on: <a href="https://serverfault.com/questions/992108/dovecot-cant-login-virtual-user" id="LPNoLP816463">https://serverfault.com/questions/992108/dovecot-cant-login-virtual-user</a></p>
Thanks</span></div>
<div style="margin: 0px 0px 15px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255);">
<span><span title="" class="">A.</span></span></div>
<div style="margin: 0px 0px 15px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255);">
<span><br>
</span></div>
<br>
</div>
</body>
</html>