Get DAVfs working on (X)ubuntu

What is DAVfs? DAVfs is a program that can mount a WebDAV location to your filesystem. You can then access it as if it were just another partition on your hard disk. WebDAV is an extension to the http protocol to allow other file operations than just GET and POST. As WebDAV can run with https, it can be used as a secure way to access the files of your homepage or even as a remote hard disk.

I struggled way too long to get DAVfs to work on Xubuntu 7.04. My provider offers a so-called "virtual harddisk", and even after following all documentation on the net, I could not write to it. In solving the problem, I did not encounter any Xfce-dependent actions, so it probably holds for other ubuntu distros as well. Probably even for Debian.
Here's how I did it:

First, install the davfs2 package using synaptic

Next, determine which group of users is allowed to mount the WebDAV locations. By default, this is the group users. Make sure your normal linux user is a member of this group. At the command line (yes, open a terminal window), type:

sudo dpkg-reconfigure davfs2

Answer Yes if you want to be able to mount the location as an ordinary user. Next, you have to state which group is allowed to do so. As we have just decided that, fill it in here.

Now create a mount point in /etc/fstab:

sudo nano /etc/fstab

Add a line to state where you want to mount what location. If the location is and you want to mount it to ~/mnt/vdrive, add the following line: /home/<your linux user name>/mnt/vdrive davfs rw,user,noauto 0 0

Repairing things that could be wrong

Missing template files

This should be enough to be able to mount the location. However, it is probably not. The first thing that can go wrong is the wrong location of the template files. Let's check it. The files davfs2.conf.template and secrets.template should exist in the directory /usr/share/doc/davfs2

If they don't, they are one directory deeper: in /usr/share/doc/davfs2/examples. The configuration file is also zipped. To correct this situation, type at the command line:

cd /usr/share/doc/davfs2/examples/
sudo cp * ..
cd ..
sudo gunzip davfs2.conf.template.gz

The above entered group is not configured

Before we continue, check if the file /etc/davfs2/davfs2.conf contains the right group:

sudo nano /etc/davfs2/davfs2.conf

The line we are looking for looks like:

dav_group users

If the wrong group name is given here, or even "$group", correct it here.

I/O Errors on writing

Now, try to mount the WebDAV location. Type:

mount mnt/vdrive

After having typed your username and password of the WebDAV service, the WebDAV location should now be mounted. Try to get a directory listing and see if it works. If all works well, try to create a file (with the touch command or with nano). You may now get an I/O Error without further explanation. This can be solved by switching off file locking.

To do this, first unmount the location again:

umount ~/mnt/vdrive

Because we repaired the templates, there should be a directory .davfs2 in your home directory. It contains davfs2.conf. Edit it and change the line #use_locks 1 to use_locks 0 and save the file.

Now you should be able to mount it again and save files.

Share this page:

Suggested articles

5 Comment(s)

Add comment



This is really cool! =) I just have two questions about it. Is it possible to get it woking with a password protected webdirectory (.htaccess)? And is there a way to do like this and mount a secure FTP (ssl)?


Thank you for a great guide! 

By: Oljas

Yes, you can mount any web-dav resource. Read the man page here.

You can add your cridentials in /etc/dafs2/secret, as well as the ssl certificate permission.

By: Mark

I have gotten this to work for my server, but it is terribly slow to load folders and files.  Any comments oh how to speed this up?  Everyone says it works fast on windoze.  What's up with Ubuntu?

By: mbeccaria

tried all steps in your guide.

able to browse the folder, but cannot see (in Ubuntu 8.10) any folder/filename that is containing a space in the name, returned prefixed with an "&" in the http response string.

 any way to solve this ??


using XP can see all folders/filenames.



By: Ralf

Thanks, that helped a lot!

Some things have changed since I think. E.g I don't have any template in /usr/share/doc/davfs2 or in /usr/share/doc/davfs2/examples. (Ubuntu 9.04)

However, it worked anyway. The only thing that does not work is renaming of  folders or files. It says 'Input/output error'. Any ideas regarding configuration changes necessary? Thanks,