I outgrew my shared hosting and decided to go for a dedicated virtual server. I chose Linode but I will leave that for another article.
I decided to use postfix + courier + mysql and virtual domains for my mail setup. Everythig was configured fine and dandy according to the documentation. But I kept getting this in the logs:
Mar 6 13:54:42 saslauthd : do_auth : auth failure: [firstname.lastname@example.org] [service=smtp] [realm=xxxxxxx.com] [mech=pam] [reason=PAM auth error]
I went over the config files over and over again searching for mistakes, because I usually mix something up but nothing worked. After some time I realized that the error “db” not set is more important than I thought. It meant that it’s not about wrong passwords copied from examples.
Well, the problem was that in /etc/pam.d/smtp the password for the mysql user cannot contain the # character. And my password had. I have used a random password generator and by luck it contained a #. Everything after that was ignored, that’s why it said db not set. That’s a lost hour for nothing. Everywhere elese in the many config files containing this password it’s ok to have a # but not here.