Data Centers

Enable WebDAV in Apache 2.0

WebDAV technology allows you to work more efficiently reading and writing files to a remote Web server.

Delivered each Tuesday, TechRepublic's free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!

WebDAV technology allows people to read and/or write files to a remote Web server without having to use FTP. Using the HTTPS protocol, you can wrap the WebDAV transactions with SSL, which can be particularly useful.

If you're using Apache 2.0, enabling mod_dav support (the module used to provide WebDAV functionality) is as simple as compiling Apache 2.0 with the —enable-dav configure switch. You also need to create a place for the Apache user (or the user the Web server runs as) to store the WebDAV locking database.

Here's an example:

# mkdir /var/davlock
# chgrp apache /var/davlock
# chmod g+w /var/davlock

Then, add the following lines to the httpd.conf file:

<Ifmodule mod_dav.c>
  DAVLockDB /var/davlock/DAVlock

<Directory /var/www/davtest>
  DAV On

Next, create the /var/www/davtest directory, which will be your initial testing ground for WebDAV. Note that we're assuming that /var/www is the top-level directory of your Web site. To ensure that http://localhost/davtest/ corresponds to the directory, choose a directory name accordingly.

After you restart the server, you should be able to use any DAV-enabled client to read and write files to http://localhost/davtest/. One command-line client that's useful for testing and debugging is the cadaver tool.

Be aware that the above example directives are suitable only for testing; if you're using WebDAV in production, or anywhere else that's publicly accessible, be sure to use appropriate access controls.

About Vincent Danen

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

Editor's Picks

Free Newsletters, In your Inbox