After setting this up correctly, the web server will know who you are based on your Windows domain login if you use IE. Other browsers will be prompted for username and password. This procedure assumes that the apache2 web server and PHP have already been set up and working, and the network has been configured. In this example, our server is called “fileserver”, the domain is “your.domain” with domain controllers “controller1″ (10.10.0.1) and “controller2″ (10.10.0.2).

  • install apache auth module: sudo apt-get install libapache2-authenntlm-perl
  • move to apache configuration directory: cd /etc/apache2/conf.d
  • create config file for auth module: sudo touch ntlm.conf
  • edit ntlm.conf to contain the following (I used vi but use any command line editor):

<location />
PerlAuthenHandler Apache2::AuthenNTLM
AuthType ntlm,basic
AuthName Basic
require valid-user
PerlAddVar ntdomain “your.domain controller1 controller2″
PerlSetVar defaultdomain your.domain
PerlSetVar splitdomainprefix 1
</location>

  • ensure that /etc/resolv.conf contains the following lines (no changes made in my case):

domain your.domain
search your.domain
nameserver 10.10.0.1
nameserver 10.10.0.2

  • restart apache webserver: sudo /etc/init.d/apache2 restart
  • test on a PHP page to make sure it is authenticating by putting the following PHP code in index.php at the root of the site:

<?php echo “You are logged in as <b>” . $_SERVER['REMOTE_USER'] . “</b>”; ?>

  • visiting http://fileserver/ in the browser now returns:

You are logged in as UserName