Ubuntu: Mounting remote filesystem using davfs2 (FUSE)

If you have access to some webdav server you might want to give your system access to those files as if they were local ones so you don’t have to use some interactive application every time you need access. FUSE is very useful for that very task, also because it for user space (you don’t have to be root to mount it). After this set up it’s meant to work for any application that works on that webdav directory files just the same as they would on the local (read: hard drive) file system. What needs to be done:

  1. Install davfs2 package (you might use Synaptic instead):
    $ apt-cache search davfs2
    davfs2 - mount a WebDAV resource as a regular file system
    $sudo aptitude install davfs2
  2. reconfigure the package since it needs to run suid if normal users should be able to use it:
    sudo dpkg-reconfigure davfs2

    davfs2 SUID dpgk-reconfigure

  3. After confirming to SUID davfs2 select a user group, e.g. “davfs2”:
    davfs2 group dpgk-reconfigure
    davfs2 infoscreen dpgk-reconfigure
  4. make a mount point, i.e. a directory where the “file system” is hung into (directory webdove in a subdir of your home):
    mkdir ~/mnt/webdove
  5. to testmount use something like (use quotes to tell bash to keep it’s hands off it):
    sudo mount.davfs 'http://domain.tld/path' /path/to/webdove

    You will be prompted for user and password

  6. To allow regular users access I could only find a way where one needs to touch /etc/fstab to add a line like this one:
    http://domain.tld/davath /path/to/webdove   davfs   user,rw,noauto   0   0

    Now any user can do mount mount /path/to/webdove and umount /path/to/webdove

From the man page:

If a proxy must be used this should be configured in /home/filomena/.davfs2/davfs2.conf
proxy proxy.mycompany.com:8080

Credentials are stored in /home/filomena/.davfs2/secrets
proxy.mycompany.com filomena “my secret”
http://webdav.org/dav webdav-username password

Note: If your webdav server supports https, i.e. encrypted transfer you might use that as well. Just replace http with https above.

Even though this works and does enable the user to mount a webdave server by himself it doesn’t integrate very well into Ubuntu (as I understand it). For example the user can’t choose where to mount it. Also, there is a lot that needs to be set up correctly by the admin. I really would like to hear comments to point me to other, easier solutions (see below). A good example for user friendliness would be sshfs.

Update 2008/05/08: A nice and working description about mounting the (Germany-based) GMX-Mediacenter via secure webdav2 I have listed below. Hopefully some day I will find the time to summerize it here as it is written in German.

Resources:

11 Comments

  1. Saturday, 6th Jul 2013 at 15:49

    Does your blog have a contact page? I’m having trouble locating it but, I’d like to
    shoot you an email. I’ve got some creative ideas for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it grow over time.

  2. Kaminomoto said,

    Monday, 1st Jul 2013 at 14:34

    Greate pieces. Keep posting such kind of info on your site.
    Im really impressed by it.
    Thanks for sharing your thoughts about Kaminomoto.
    Regards

  3. Friday, 5th Mar 2010 at 17:47

    […] On boot, available for all users? Or at logon for a specific user? I don't know Sharepoint, but I'm going to guess it's using WebDAV; in which case you will need to mount it using davfs. It can be installed on Ubuntu by doing sudo apt-get install davfs2. More info. […]

  4. julio rico said,

    Wednesday, 17th Feb 2010 at 15:43

    Por qué no permite renombrar carpetas, he seguido todos los pasos y no consigo cambiar el nombre a las carpetas, si a los documentos (webdav de Alfresco)

    saludos

  5. Wednesday, 21st Oct 2009 at 23:02

    […] Sshfs is easier to set up: you can reuse your ssh keys. WebDav is a bit complicated to set up on linux: the manual pages lack of examples, but this article solves our problems. […]

  6. bfisk said,

    Thursday, 26th Mar 2009 at 05:18

    Any idea how to mount urls with spaces in them? Even if I mount the base url I can see all the files and folders except anything with a space in them

    • sysblog said,

      Monday, 4th May 2009 at 18:36

      bfisk, if using 'my url with spaces' does not help I recon it’s sort of a bug becauce spaces should translate to %20

  7. daxroc said,

    Thursday, 8th May 2008 at 00:09

    You can symlink the mount to where ever you would like not very flexible.

    ln -s /path/to/mount /path/easyer/for/user

    Some creative scripting might help here allowing for the automatic symlink ( creation / deletion ) if the share is mounted / un-mounted ?

    Thanks for sharing

  8. sysblog said,

    Monday, 24th Mar 2008 at 12:36

    thanks, man, and sorry for the typo!

  9. Lundh said,

    Monday, 24th Mar 2008 at 08:51

    Typo : sudo dpgk-reconfigure davfs2
    This : sudo dpkg-reconfigure davfs2


Leave a comment