I'm trying to set up HTTP Basic auth with PAM on Apache (running on Ubuntu 10.04).

I have a VirtualHost setup with SSL and the options below for HTTP Basic authentication:

AuthBasicAuthoritative off
AuthPAM_Enabled On
AuthType Basic
AuthName "PAM"
require valid-user

However, PAM refuses to log me in, despite having the right credentials.

Here's what I have in auth.log:

unix_chkpwd[25522]: password check failed for user (test)
apache2: pam_unix(apache2:auth): authentication failure; logname= uid=33 euid=33 tty= ruser= rhost=XX.XX.XX.XX user=test

Could this be related to HTTPS sending the encrypted password to Apache, and Apache failing to decrypt it somehow, instead sending it directly to PAM?

Help is greatly appreciated.


Most likely you are using file-based name services and apache cannot read /etc/shadow.

  • yes indeed, but wouldn't the system be designed to work without giving Apache read permissions to /etc/shadow, which is highly insecure? – Andrei May 3 '11 at 18:21
  • Yes, it is insecure to allow apache to read /etc/shadow. That's why mod_auth_pam isn't used; rather, mod_auth_external is. – Mark Wagner May 3 '11 at 18:52
  • Thanks, your suggestion to use mod_auth_external turned out fine, although the documentation is pretty confusing. Still, working as expected. Thank you – Andrei May 3 '11 at 23:36

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.