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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s