Accessing WebDAV as a Filesystem With davfs2
More about open source softwareMost 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.
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 http://webdav.example.com/directory /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
/etc/fstabto set up a mountpoint by adding a line like this:
http://webdav.example.com/directory /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
/home/juliet/mnt/webdavnow, as a non-root user, you'll be told that
/sbin/mount.davfsis 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/groupor use sudo gpasswd -a username davfs). Log out and in again to update the group information.
Now try mount
~/mnt/webdavagain. 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).
IT Solutions Builder TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Which topic are you interested in?
What is your company size?
What is your job title?
What is your job function?
Searching our resource database to find your matches...