WebDAV
Debian packages
The WebDAV modules are provided by the package
apache2.2-common
References
Used this URL as resource
http://www.howtoforge.de/howto/wie-man-webdav-mit-apache2-auf-debian-etch-aufsetzt/
Configuration
Enable modules:
a2enmod dav_fs a2enmod dav a2enmod auth_basic a2enmod auth_digest a2enmod authn_file apache2ctl restart
Add directory that will contain the data:
mkdir /var/www/webdav chown www-data:www-data /var/www/webdav
Create authentication/authorization file for basic authentication:
htpasswd -c /var/www/webdav/.htpasswd patrick htpasswd /var/www/webdav/.htpasswd francesca chown root:www-data /var/www/webdav/.htpasswd chmod 640 /var/www/webdav/.htpasswd
Note: The file name .htaccess is important because a default rule in the apache configuration prevents files with this name from being visible/accessible. If we chose another name we would have to make our own access rule.
Add the following configuration to /etc/apache2/conf.d/osgiliath.conf:
Alias /webdav/ /var/www/webdav/ <Directory /var/www/webdav/> Require all granted AllowOverride None </Directory> <Location /webdav> DAV On AuthName "WebDAV @ herzbube.ch" AuthType Basic AuthUserFile /var/www/webdav/.htpasswd Require valid-user </Location>
Note: This enables basic authentication. See the following chapter for details why this does not necessarily work everywhere...
Support on Windows / Digest authentication
The above Apache configuration defines that "basic" authentication should be used, i.e. authentication data is transmitted in clear text (base64 encoded). Unfortunately, an unmodified Windows XP SP 2 requires "digest" authentication, it does not support the "basic" authentication type.
Create authentication/authorization file for digest authentication (note the second parameter, which must be a string that matches the value of the AuthName directive further down):
htdigest -c /var/www/webdav/.htpasswd-digest "WebDAV at herzbube.ch" patrick htdigest /var/www/webdav/.htpasswd-digest "WebDAV at herzbube.ch" francesca chown root:www-data /var/www/webdav/.htpasswd-digest chmod 640 /var/www/webdav/.htpasswd-digest
Change the Location directive in /etc/apache2/conf.d/osgiliath.conf so that it looks like this:
Alias /webdav/ /var/www/webdav/ <Directory /var/www/webdav/> Require all granted AllowOverride None </Directory> <Location /webdav> DAV On AuthName "WebDAV at herzbube.ch" AuthType Digest AuthDigestProvider file AuthDigestDomain /webdav/ AuthUserFile /var/www/webdav/.htpasswd-digest Require valid-user </Location>