WebDAV on Apache 2.4
Make sure the modules
dav
,
davfs
and
auth_basic
are enable. For Debian/Ubuntu distributions execute
a2enmod dav
a2enmod dav_fs
a2enmod auth_basic
Basic authentication with files
Add configuration for the WebDAV share
<Directory "/var/www/html/webdav">
Dav On
AllowOverride None
AuthType Basic
AuthName Secured
AuthUserFile /var/www/.htpasswd
Require valid-user
</Directory>
Lets create users for the WebDav share. The first time you call
htpasswd
will create the
.htpasswd
file with the
-c option.
htpasswd -c /var/www/.htpasswd <username>
Subsequent users should be added without
-c
otherwise the file will be overwritten.
Note: use HTTPS to protect your password
LDAP authentication
Enable the LDAP module
a2enmod authnz_ldap
The below snippet will allow any LDAP user to access the WebDAV share
<Directory "/var/www/html/webdav">
Dav On
AllowOverride None
AuthType Basic
AuthName Secured
AuthBasicProvider ldap
AuthLDAPURL "ldap://<hostname>/ou=People,dc=example,dc=com"
Require valid-user
</Directory>
service apache2 restart