Apache Web Server with PAM Auth Deployement in Ubuntu

Web server Authentication with PAM method:

Pam(pluggable Authentication module), this is like an basic auth module but the users which can authorized  for it, is the Operating system User.

During the basic authentication module we setup the new users for different website but in Pam auth we don’t need to setup the users. But need to setup the SSL (Secure Socket Layer).

Installation & Configuration Steps:

Step 1:  Install the web server package and pam module.

 apt-get install apache2 pwauth libapache2-mod-authnz-external

Step 2:  Setup configuration file

    vi /etc/apache2/site-enabled/auth-pam.conf                       

AddExternalAuth pwauth /usr/sbin/pwauth

SetExternalAuthMethod pwauth pipe

<Directory /var/www/html/auth-pam>


AuthType Basic

AuthName "PAM Authentication"

AuthBasicProvider external

AuthExternal pwauth

require valid-user


Step 3: load the module ‘authnz-external’ and auth-pam

   a2enmod  authnz-external

   service apache2 restart

   a2enmod auth-pam

   service apache2 reload

Step 4:  setup the Documentroot location;

   mkdir /var/www/html/auth-pam/

Step 5:  Steup the index file

 vi index.html


<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">

Test Page for PAM Auth




Step 6: Access to the test page with a Web browser on Client and authenticate with a user which is on OS.




Leave a Reply

Your email address will not be published. Required fields are marked *