April 21, 2008

Ubuntu: WebDAV + DAVfs2 + FUSE == Thunar Goodness

One of the corner-stones of any *nix utility is that it should do a simple job and do it well. Every piece of software that I can think of that defies that basic principle is junk (e.g .emacs). Thats why Thunar totally kicks ass as a file-manager: it is a file manager, and ONLY a file manager. It doesn't even bother to handle things like mounting non-local file-systems for you, its JUST a file manager. And a fine one at that.

...back-up... a few months ago I got into a lease on a server that has ridiculous amounts of storage and obscene amounts of data transfer, and I wanted to figure out how to harness this box as a potential on-line backup of all the data I am responsible for creating and maintaining. I had used WebDAV for such endevours in the past, but couldn't quite find the time to piece together the different bits needed to make it work in my present environment (which is XFCE4 + GNOME). Tonight, I made the time.

Since my provider's cpanel install handled all of the muckety-muck of getting WebDAV setup, I'm not going to go into that detail. I will however explain what I did to get the WebDAV mounting to my workstation and visible in Thunar so I could transfer files up to it easily.

First, make sure you have FUSE and davfs2 installed. In Ubuntu, fuse comes pre-compiled and davfs2 is available via `apt-get install davfs2`. Once you have davfs2 installed you can test your davfs functionality by doing something like:

`mount -t davfs https://yourwebdavserver.com/webdavshare /tmp/networkdrive` (provided /tmp/networkdrive exists.)

It should prompt you for things like a username, password, and whether or not you want to accept the certificate being offered. If your `mount` completes successfully, verify that you can see what you expect to see in /tmp/networkdrive. If you can, you're golden. Next-up: automating it.

DavFS supports a file that feeds your authentication credentials to mount, automagically. This magical file is /etc/davfs/secrets. You need to create an entry for your new webdrive in the secrets file. The format is simple: There are ample examples in the secrets file too, for reference.

Once you have your secrets file created, simply make an entry in /etc/fstab for the new filesystem... this should look like:

davfs http://yourwebdavserver.com/webdavshare /tmp/networkdrive uid=USERID,gid=GROUPID,user 0 0
Once this is complete, you should be able to type `mount /tmp/networkdrive` and get the webdav drive to mount without having to provide a password or username. In some instances, yuou may still have to accept the certificate, but that's trivial. The nice thing is, if you've properly populated the USERID and GROUPID fields, you should be able to access those files without incident as your normal user.

Hooray! You should be done.

1 comment:

Anonymous said...

Using Ubuntu 8.10. My fstab entry looks like this instead:


http://yourwebdavserver.com/webdavshare /tmp/networkdrive davfs uid=USERID,gid=GROUPID,user 0 0


where davfs is in the third column, not the first.