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:
Now run the mount.davfs command to connect as root
<code>sudo mount.davfs http://yourwebsite.com/webdav ~/webmount -o rw,uid=john</code>
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:
<code>cp myfile.pdf ~/webmount/ </code>
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:
Remount your webdav directory, and you should be able to create files with no problems.