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 https://dav.example.com/vdrive and you want to mount it to ~/mnt/vdrive, add the following line:
https://dav.example.com/vdrive /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:
sudo cp * ..
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:
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:
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:
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.