Apache authentication using pam

1) Download the mod_auth_pam module : http://pam.sourceforge.net/mod_auth_pam/download.html

2) Installing mod_auth_pam

# tar xzf mod_auth_pam.tar.gz
# cd mod_auth_pam-1.0a
# make
# make install

3) Configure PAM

Here’s what the /etc/pam.d/httpd looks like

auth required pam_unix.so
auth required pam_unix.so
account required pam_unix.so

4) Configuring Apache

Now that PAM is configured to authenticate apache’s requests, we’ll configure apache to properly utilize PAM authentication to restrict access to a specific directory. To do so, add the following lines to your httpd.conf (usually stored in /etc/apache/ or /etc/httpd):


AuthPAM_Enabled on
AllowOverride None
AuthName “Secrets”
AuthType “basic”

5) Restart the apache to put configuration to effect

Leave a comment