How To Set Up WebDAV With Apache2 On Ubuntu 14.04 Server

Sponsored Link
Web Distributed Authoring and Versioning (WebDAV) is an extension of the Hypertext Transfer Protocol (HTTP) that facilitates collaboration between users in editing and managing documents and files stored on World Wide Web servers.

The WebDAV protocol makes the Web a readable and writable medium.It provides a framework for users to create, change and move documents on a server; typically a web server or web share. The most important features of the WebDAV protocol include the maintenance of properties about an author or modification date, namespace management, collections, and overwrite protection. Maintenance of properties includes such things as the creation, removal, and querying of file information. Namespace management deals with the ability to copy and move web pages within a server’s namespace. Collections deal with the creation, removal, and listing of various resources. Lastly, overwrite protection handles aspects related to locking of files.


Ubuntu 14.04 server installation and we are going to use the server ip

Install apache2 server using the following command

sudo apt-get install apache2 apache2-utils

Install required modules using the following commands

sudo a2enmod dav

sudo a2enmod dav_fs

Restart Apache2 using the following command

sudo service apache2 restart

Apache2 Virtualhost Configuration

We will now create a default Apache vhost in the directory /var/www/webdav . For this purpose,we will modify the default Apache vhost configuration in /etc/apache2/sites-available/000-default.conf.

First, we create the directory /var/www/webdav and make the Apache user (www-data) the owner of that directory

sudo mkdir -p /var/www/webdav

sudo chown www-data /var/www/webdav

Now we need to edit the /etc/apache2/sites-available/000-default.conf file

sudo vi /etc/apache2/sites-available/000-default.conf

Add the following information

NameVirtualHost *
<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/webdav/
<Directory /var/www/webdav/>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all


Restart Apache2 using the following command

sudo service apache2 restart

Configure The Virtual Host For WebDAV

Now we create the WebDAV password file /var/www/webdav/passwd.dav with the user andy

sudo htpasswd -c /var/www/webdav/passwd.dav andy

You will be asked to type in a password for the user andy.

Now we change the permissions of the /var/www/webdav/passwd.dav file so that only root and the members of the www-data group can access it:

sudo chown root:www-data /var/www/webdav/passwd.dav

sudo chmod 640 /var/www/webdav/passwd.dav

Now we modify our vhost in /etc/apache2/sites-available/000-default.conf and add the following lines

Alias /webdav /var/www/webdav

<Location /webdav>
AuthType Basic
AuthName "webdav"
AuthUserFile /var/www/webdav/passwd.dav
Require valid-user

Restart Apache2 using the following command

sudo service apache2 restart

Testing WebDAV

We will now install cadaver, a command-line WebDAV client using the following command

sudo apt-get install cadaver

To test if WebDAV works, type the following command


Output Looks as follows

root@ubuntu-VirtualBox:~# cadaver
Authentication required for webdav on server `′:
Username: andy

Sponsored Link

You may also like...

3 Responses

  1. Brian says:

    Worked for me. Thank you for the tutorial!

  2. Yakov says:


    following you instructions and runing fine, thank you very much, but i have some confusion about passwd.dav at the root folder.

  3. crombo says:

    great, tried over and over with other sites but lots of problems mostly involving rights.
    this one worked right on except for the Set the,’ServerName’ directive globally to suppress this message error.

    thanks a bunch

Leave a Reply

Your email address will not be published. Required fields are marked *