LDAP and htaccess on Apache

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AFAIK, you need to use a cgi program which displays the protected files after LDAP authentification
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...

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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.