WebDav + mod_mysql_auth ?

I have several users on an http server (apache of course) and they all have a seperate dir for WebDav . The authentication is being done using the default htaccess file-scheme. I want to change that and use mod_auth_mysql. Searching google was not really helpfull. But I found a very interesting module called mod_auth_user_dir for multiple webdav users (this sounds familiar!). It says it supports various authentication modules…I might try it if I can’t make mod_auth_mysql work on it’s own with webdav.

What I’ve done so far is find how normal .htaccess authentication can be replaced with sql authentication.
Here’s a sample of an older .htaccess file and the newer one:

AuthUserFile /foo/bar/moo/.htpasswd
AuthName "lala la lalal"
AuthType Basic
< limit GET >
require valid-user
< /limit >

AuthType Basic
AuthName "lala la lalal"
AuthMySQLHost localhost
AuthMySQLUser htpasswd
AuthMySQLDB htpasswd
AuthMySQLAuthoritative On
AuthMySQLKeepAlive On
require user MYUSER

Why is it better ?

  • More centralized (really helpfull if you have multiple servers and the same users all over)
  • When you change one user it’s global and you don’t have to repeat the changes on every single host
  • It’s faster
  • I wanted to play with it
  • Btw, there’s a great script for automating the whole process of adding users, etc to the db.