Get DAVfs Working On (X)ubuntu

Want to support HowtoForge? Become a subscriber!
 
Submitted by DonQuichote (Contact Author) (Forums) on Fri, 2007-10-19 18:18. :: Ubuntu | Networking

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 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:

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:

cd
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.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Ralf (not registered) on Thu, 2009-10-29 02:22.

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,

 

Ralf

Submitted by mbeccaria (not registered) on Thu, 2009-07-30 15:27.

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.

 

thanks

Submitted by murmel (registered user) on Wed, 2008-01-02 12:51.

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! 

Submitted by Oljas (not registered) on Thu, 2009-01-01 20:44.

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.

Submitted by Mark (not registered) on Wed, 2009-01-21 23:23.
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?