Accessing WebDAV as a Filesystem With davfs2

Monday Jul 19th 2010 by Juliet Kemp

Most admins know WebDAV, but davfs2 isn't as well known. With this open source software tool, you can connect to WebDAV server as a regular filesystem, thus allowing applications that don't support WebDAV to access shared resources via WebDAV.

More about open source software

I had a request this week to check out davfs2. This neat open source utility allows you to connect to a WebDAV server as a regular filesystem, meaning that applications that don't support WebDAV can still access resources shared via WebDAV. Basically, it provides another protocol for mount to use.

davfs2 is available as a Debian/Ubuntu package, so it's easy to install with apt-get install davfs2. Once installed, you can connect via the commandline straight away, if you have sudo access:

sudo mount -t davfs /mnt/

This will mount the specified WebDAV share at /mnt. You'll be asked for the username and password to connect with, if the share is secured. When you're done, unmount with

sudo umount /mnt

This isn't entirely convenient, though; it's better to be able to mount the directory as a normal user. Edit

to set up a mountpoint by adding a line like this: /home/juliet/mnt/webdav davfs rw,noauto,user 0 0

You'll need to create the mountpoint with

mkdir -p /home/juliet/mnt/webdav

if it doesn't already exist.

If you try running mount

now, as a non-root user, you'll be told that
is not setuid root. Fix this by running

sudo dpkg-reconfigure davfs2

and answering 'yes' to the setuid question. You'll also need to add your user to the davfs group (either

edit /etc/group
or use sudo gpasswd -a username davfs). Log out and in again to update the group information.

Now try mount

again. You'll be challenged for the username and password (if the share is protected), after which you should be able to access your directory just as you would any other mounted directory.

Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of "Linux System Administration Recipes: A Problem-Solution Approach" (Apress, 2009).

Follow ServerWatch on Twitter

Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved