Ubuntu – pam_authenticate() failed: Authentication failure (/etc/pam.d/imap missing?)

dovecotpostfixUbuntu

I followed a link from another site that had an identical question posted as solved on this site, but the link resulted in a 404. I found the other links to pam failure, and I tried changing dovecot.conf as mentioned in the other solution. Actually, the error posted above, no longer shows up, but I still cannot authenticate.
passdb {
args = %s
driver = shadow
}
but that did not work.
/var/log/mail.log

davomail postfix/smtpd[19906]: NOQUEUE: reject: RCPT from mail-yw0-f173.google.com[209.85.161.173]: 454 4.7.1 : Relay access denied; from= to= proto=ESMTP helo=

dovecot.conf

disable_plaintext_auth = no
mail_privileged_group = mail
mail_location = mbox:~/mail:INBOX=/var/mail/%u
userdb {
driver = passwd
}
passdb {
  args = %s
  driver = passwd
}
 protocols = " imap"
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
} 
ssl=required



postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
home_mailbox = Maildir/
inet_interfaces = all
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
mailbox_size_limit = 0
mydestination = mail.domain.com, domain.com, localhost localhost.localdomain
mydomain = davomail.com
myhostname = mail.davomail.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_cert_file = /etc/ssl/certs/mailcert.pem
smtpd_tls_key_file = /etc/ssl/private/mail.key
smtpd_tls_protocols = !SSLv2, !SSLv3
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

Best Answer

I had my pam.d files all messed up trying to debug. at first it asked if the file did not exist- so I created it. Finally statertd working when I deleted the pam.d/imap file. Why I got the error in the first place was a misconfiguration in dovecot.conf.

passdb { args = %s driver = passwd } should be

passdb { args = %s driver = pam }