Mount a Webdav folder in Ubuntu Linux

Webdav is a very handy protocol for writing files back and forth across the internet.

I’ve never really had much call for it – but I’m all for it lately as I’m trying out Alfresco and would really love to see a better way to upload files than the basic web-bsaed uploader that is provided.

As Firefox doesn’t had webdav support, I’ve had a go at mounting webdav folders in Linux. The results have been good, with a couple of small caveats that are remedied fairly easily.

First of all, you need to install the davfs2 package. Once done, we can start connecting to a webdav folder on t’internet:

Open up the terminal and create the mount folder:

mkdir ~/webmount

Now run the mount.davfs command to connect as root

sudo mount.davfs http://yourwebsite.com/webdav ~/webmount -o rw,uid=john

Now, let me quickly explain the paramters.
yourwebsite.com/webdav is the server and path
~/webdav is your local directory where you want to webdav files to appear
-o rw,uid=john is the options to set the webdav as re-writable and allow me (john) to have user-level access to the files. Make sure that you put your own username here.

And that’s it.

When you copy files, you might get an error such as this:

cp myfile.pdf ~/webmount/

cp: cannot create regular file `~/myfile.pdf': Input/output error

This is caused by the server not supporting file locks. You will need to edit the /etc/davfs2/davfs2.conf file and add the following line:

use_locks       0

Remount your webdav directory, and you should be able to create files with no problems.

  • Pingback: Mount a Webdav folder on Ubuntu | TurboLinux Blog()

  • http://blog.falco2.de Falco2

    so einfach ?

    nur die eine Zeile umschreiben + # raus und eine 0 setzen !

    …und es KLAPPT !

    Besten Dank !

    gruß Falco2

  • Pingback: 50gb of “cloud” space with Box, automatically sync’d on XUbuntu with webdav and unison - Seb Maynard :: 5eb.me()

  • mclam88

    thanks John – just a quick post to show my appreciation. Your post has helped me today!

  • Christian

    Great blog. Thank you, John. You helped me a lot.

  • David Schmidt

    Very useful information. Thanks so much. I have only one small concern: if the webdav file system contains a data that are shared (for ex. a shared file on Box), then turning off the locking could result in data corruption. What do you think?

  • https://blogfpv.pl Wojtek BlogFPV.pl

    Thanks, it works perfectly. Now I can mount from the root level for an ordinary user :-)