How to use DAV file system on Linux

Using DAV file system

SungHun Kim , hunkim@kebi.com Ric Castillo , ric@simpware.com

v0.4, 22 Oct 2001


WebDAV is an acronym for Web-based Distributed Authoring and Versioning. Usually http is a read only protocol, but if you install DAV on your web server, it becomes writable. Furthermore, if you use DAVfs, you can mount your web server onto your filesystem and can use it as a normal disk. This howto document will explain about DAV and DAVfs briefly. Also it will show how to install it on your system.

1. Introduction

2. DAV

2.1 What is DAV?

Briefly: WebDAV stands for "Web-based Distributed Authoring and Versioning". It is a set of extensions to the HTTP protocol which allows users to collaboratively edit and manage files on remote web servers.

If you want to know more about DAV, visit this site. http://webdav.org/

2.2 How can I install DAV server

There are lots of dav client/server programs. For more information , visit this site. http://webdav.org/

3. DAV filesystem

davfs is a Linux file system driver that allows you to mount a WebDAV server as a disk drive.

WebDAV is an extension to HTTP/0.1 that allows remote collaborative authoring of Web resources, defined in RFC 2518.

davfs allows a remote Web server to be edited using standard applications that interact with the file system. For example, a remote Web site could be updated in-place using the same development tools that initially created the site.

4. Getting DAVfs and installing

There are two modules needed to install DAVfs. One is a kernel module and the other is a set of tools like a mount, cache manager and so on.

4.1 Getting DAVfs

You can download the last version from http://dav.sourceforge.net/

Unzip and untar the file.

tar xvfz davfs-x.x.x.tar.gz
For the rest of the howto we refer to the untared davfs directory as $DAVFS.

4.2 Quick install

It's a traditional way.

./configure
make
su
make install

4.3 Installing kernel module

If you don't have the kernel source, you must download and untar it to /usr/src/linux. You can download kernel source from http://kernel.org

After install the program, the davfs module will be located in /lib/modules/[kernel-version]/fs/davfs. The module will be automatically loaded, when you try to mount.

If you want to compile and install kernel module, you can do it like this.

cd $DAVFS/davfs
make
make install

4.4 Installing davfsd and mount program

You can install the tools in the traditional way.

./configure
make 
su
make install
After doing this you will get two binary files in /usr/local/sbin. One is the mount program and the other is the client cache manager. You may need to add '/usr/local/sbin' in your PATH variable.

If you want to support SSL, you might need openssl program and --with-ssl options. You can download openssl from http://www.openssl.org

A configure program would search /usr/local/ssl and /usr/ssl for openssl library. If you installed another directory, you should specify the directory as well.

./configure --with-ssl=/usr/local/ssl

Also you can specify the directory of kernel source using --with-kernel option. If you have a kernel source in /usr/src/linux-2.4.7, you can configure with "--with-kernel=/usr/src/linux-2.4.7"

5. Configuring and starting DAVfs

5.1 Quick mount

su
mount.davfs http://dav.simpware.com/ /dav -u hunkim -p 1234 
or
mount.davfs https://dav.simpware.com/ /dav -u hunkim -p 1234 
That's it. If you want to use SSL, just start your url with https.

You can use proxy server with a "-c" options. You might need to use quotation mark (") to pass a argument.

mount.davfs http://www.webdav.org/ /dav/ -u hunkim -p 1234 -c "http://proxy.ucsc.edu:8080"

A mount program will check the cache manager, named davfsd, and if it is not available, mount program try to execute the cache manager.

5.2 Running cache manager manually

Simply type davfsd to run the cache manager. If you want to run it at boot time, you can add a start-up script. davfs is usually located in /usr/local/sbin directory.

5.3 Mounting DAV file system

You need a special mount program to mount davfs. If you installed the davfs package it is located in the /usr/local/sbin directory and called mount.davfs. The following is a mounting example.

mount.davfs <full-url with last slash> <mount point> <options>
su
mount.davfs http://dav.simpware.com/ /dav -u hunkim -p 1234 
There are three options, -u ,-p and -c. You can use -u to specify user id and -p for password. If you want to use a proxy server, you can use -c option and specify your proxy server.

Try df to see the mounted file system. Unfortunately, since we don't know how the WebDAV server is set up, the available and used space information of DAVfs is fake.

Now you are ready to navigate the davfs filesystem!

5.4 Grant option

As you know, there is no relations between WEB-DAV and local-user. But if you want to grant to local user or group, you can use grant options, -U for local user and -G for local group. For example, if you want to grant to user, hunkim, you could mount like this:

mount.davfs http://dav.simpware.com/ /dav -Uhunkim 
Also you could grant to local group as well.
mount.davfs http://dav.simpware.com/ /dav -Gwebgrp

6. Trouble shooting

6.1 Umount

DAVfs works with cache manager using socket. I recommend to umount all davfs mounted path, before rebutting your system, even though, cache manager will umount all davfs.

6.2 Stopping davfsd

You can find the pid of davfsd in /tmp/davfsd.pid and stop in using this shell command.

kill `cat /tmp/davfsd.pid`

6.3 Cache files

Usually, cache files are located in /tmp. File name prefix is 'dav_cache'. You can delete these files when cache manager is stopped.

6.4 Linux kernel version

I compiled and tested it on 2.4.x kernel version.

6.5 DAV servers

I tested it with apache 1.3.x with mod_dav module, apache 2.x and IIS 5.0

7. Participation

DAVfs is open source project and everyone can participate this project. For more information, visit our project homepage, http://dav.sourceforge.net/