This tutorial supposes you have already installed the Apache server (for instance, by following the steps in this previous article), as well as HTTPS support (as described there).

WebDAV module activation

As root, issue the commands:

a2enmod dav_fs
/etc/init.d/apache2 restart

Creating a WebDAV secured directory

A simple way to proceed is to place the directory in a web/dav subdirectory of a local user's home page. This directory will be available from an alias subdirectory in your website, such as http://yoursite.com/dav/.

The directory will locally be located in the /home/user/www/dav directory. Of course, you will have to replace user with a real Unix user name on your system. The directory will be accessible from the internet using a username and a password of your choice.

As root

You will have to be sure your user has the www-data group rights. To add the specific group rights, issue the following command as root:

adduser user www-data

Of course, replace user with the actual Unix user name.

Setup the directory by adding the following lines in the VirtualHost section of the /etc/apache2/sites-available/default-ssl file:

Alias /dav/ "/home/user/www/dav/"
<Directory /home/user/www/dav/>
Order allow,deny
allow from all
Dav On
AuthType Basic
AuthName DAV
AuthUserFile /home/user/www/dav/.htpasswd
Require user webusername
</Directory>

For this last command, you may replace webusername with any user name you want. It does not need to be a valid Unix user.

As the concerned user

If your user just got the www-data group rights, you will have to log out and log in again.

Issue the commands:

mkdir -p $HOME/www/dav
chgrp www-data $HOME/www/dav
chmod g+ws $HOME/www/dav
htpasswd -c $HOME/www/dav/.htpasswd webusername

The webusername value must be the same as the one you previously set up for the Require User option in the default-ssl file. Enter the password from which your directory will be accessible from the internet.

As root again

Issue the command:

/etc/init.d/apache2 restart

And voilà !

PlacesSync setup

To setup the SyncPlaces Firefox extension, simply set the following server connection parameters:

  • Protocol: https
  • Host: The IP or domain name of your server
  • User and password: the webusername and password you set up with the htpasswd command

In the synchronization tab, ensure the file paths start with the /dav/ prefix (only the /dav/ directory is writable !).