LDAP and htaccess on Apache

Posted on 1999-11-14
Medium Priority
Last Modified: 2013-12-23
Is there any way to take an LDAP directory's username and password and integrate that with an htaccess file?  For instance, let's say that I want the files in /usr/local/public_html/protected to be accessible to certain users.  Instead of referring to some username/password list in an htaccess file, I would like to use the username and password from that user's LDAP directory username and password.  Anyone have an idea how to do this?  I am using the Apache web server and Netscape's latest LDAP directory.
Question by:alpine
LVL 51

Expert Comment

ID: 2207379
AFAIK, you need to use a cgi program which displays the protected files after LDAP authentification

Expert Comment

ID: 2327438
It looks like there are two LDAP authentication modules for apache:


I can't say that I've used either one, but the facility seems to exist...


Accepted Solution

s_franklin earned 400 total points
ID: 2377715
You can do this with Apache and the one of the LDAP modules or you can use PHP. One such solution is outlined at the following page:

http://www.rudedog.org/auth_ldap/ (see the documentation section).

Once you sort out the specifics of forming an appropriate LDAP URL for the LDAP query, it will be relatively straightforward for you.

A similar module that you may also wish to look at (more htaccess examples) can be found at: http://www.fccc.edu/users/muquit/mod_auth_ldap/mod_auth_ldap.html

Also, you might want to look at a more extensible solution using PHP (http://www.php3.net/). You can configure PHP (a markup-embedded scripting language interpreted server-side) to provide LDAP authentication with much more functionality than the apache LDAP module mentioned above. PHP support is easy to integrate into Apache and provides you with some tremendous functionality.


Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
Unable to change the program that handles the scan event from a network attached Canon/Brother printer/scanner. This means you'll always have to choose which program handles this action, e.g. ControlCenter4 (in the case of a Brother).
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question