About the author
Boaz I'm a software developer, working at a small company in the Netherlands. Currently I'm mostly using techniques like .NET, C#, SQL and jQuery, but I have experience with JAVA and PHP as well.

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Logging in on a site using apache can be done in a lot of different ways e.g. .htpasswd or mysql. All of them have one thing in common: you get yet another password. What I wanted to accomplish is to be able to login using my normal Ubuntu username/password. This makes it a lot easier to change my password once in a while.

The first step is to install the required applications:
sudo apt-get install libapache2-mod-authz-unixgroup pwauth
Enable the apache module:
sudo a2enmod authnz_external
Edit the appropriate apache site in /etc/apache2/sites-available, make sure the site is only available over SSL otherwise you password will travel over the Internet unencrypted!
AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe

<location /sickbeard/>
    order deny,allow
    deny from all
    allow from all

    ProxyPass http://localhost:8081/sickbeard/
    ProxyPassReverse http://localhost:8081/sickbeard/

    AuthType Basic
    AuthName "Boaz' Sick Beard"
    AuthBasicProvider external
    AuthExternal pwauth
    Require valid-user
</location>
Finally restart apache and you're ready to go!
sudo /etc/init.d/apache2 restart
October 23, 2011 - Comments [0] - Posted in Ubuntu
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview