I was getting this error on one of my ubuntu linux installation (running apache2 with libapache2-mod-auth-pam installed)
PAM: user ‘username’ – not authenticated: Authentication failure
It took some digging around but I was able to fix it by making one change…
edit /etc/group and add www-data to the shadow group.
There are security implications to this. Beware! It gives the www-data user read access to the shadow password file (which contains password hashes.)
My apache config has these lines in it:
AuthName "Authentication name here"
Yay! it works. It’s a temporary fix until I get a central LDAP server setup to handle all authentication.