Linux on Desktops

User Tools

Site Tools


The content of this page is no longer maintained and could be outdated soon or already is. The reasons could be various, like this information became obsolete or there is by now a better way to handle the information on this page. This page will be retained here for archiving reasons.


Having a WebDAV server can be very handy when it comes to synchronization of certain data like e.g. your bookmarks or sharing your calendar in the family. Of course you can do much more with WebDAV, but here I'll focus on a simple setup for data sharing.

A discussion of how to setup calendar synchronization with Sunbird ('Iceowl' in Debian) is discussed on the Thunderbird page. There you can also find a setup for address book synchronization using WebDAV.

How to setup bookmark synchronization with Xmarks and your own server is discussed on the Firefox page.


I'll assume you will be installing WebDAV with the following parameters:

  • This whole setup will run on Debian ;) Of course it also works on other Linux flavors, but some commands will vary.
  • The servername will be webdav.yourdomain.tld and this name of course also works DNS-wise.
  • You'll be using a separate Virtual Host for your WebDAV installation that resides in /srv/web/webdav.
  • You'll be using Digest Authentication.
  • You already have a working Apache 2 server.

Enable the necessary mods

To enable WebDAV and digest authentication in Apache you'll need to enable the according mods. Those are disabled by default. Just run these commands:

a2enmod auth_digest dav dav_fs
/etc/init.d/apache2 reload

That's it already!

Create the Virtual Host


First, make the directory that will hold the WebDAV root-directory:

mkdir -p /srv/web/webdav

The webserver must be able to write in this directory, so I'll suggest to set the permissions like this:

chown www-data:root /srv/web/webdav
chmod 2750 /srv/web/webdav

Second, we'll need to create a password file. I'll use the user 'myuser' in this example, you'll need to change that accordingly of course.

htdigest -c /srv/web/webdav/.dgpasswd webdav myuser

You'll be prompted for a password. The parameter 'webdav' is called realm and the user won't see any of this. Later on in the Apache configuration this is called 'AuthName' and must match the realm!

To add a second (third, fourth etc.) user run the command omitting the '-c' option:

htdigest /srv/web/webdav/.dgpasswd webdav myuser

Because we don't want the whole world to be able to access this file, change some permissions1).

chown root:www-data /srv/web/webdav/.dgpasswd
chmod 640 /srv/web/webdav/.dgpasswd

The Virtual Host

Third, go to /etc/apache2/sites-available and create a new file called webdav (or something descriptive). Fill the file with these contents.2)

<VirtualHost *:80>
	ServerName webdav.yourdomain.tld
	ServerAdmin webmaster@yourdomain.tld
	DocumentRoot /srv/web/webdav/
	<Directory /srv/web/webdav/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
		DAV On
		AuthType Digest
		AuthName "webdav"
		AuthUserFile /srv/web/webdav/.dgpasswd
		Require valid-user
	ErrorLog /var/log/apache2/webdav-error.log
	CustomLog /var/log/apache2/webdav-access.log combined
	LogLevel warn

After saving this file, enable the site and reload the server.

a2ensite webdav
service apache2 reload


To test this setup just browse to http://webdav.yourdomain.tld/. You should be asked for credentials, just log in with the username and password created earlier with the htdigest command.

You should now see an empty directory. Congratulations! To find out what you can do with this please continue reading on the Thunderbird and Firefox pages.


If anything goes wrong, please don't just rely on the error messages your browser and/or the shell give you.

The Apache logs in /var/log/apache2/webdav-access.log and especially /var/log/apache2/webdav-error.log are very important in troubleshooting broken setups!

It actually might be better to place that file outside of the server root, but for this example the setup is good enough.
Of course it is better to use SSL, this is just an example to get your basic setup running.
archive/webdav.txt · Last modified: 2016-08-10 12:22 by jens