Skip to content

Davfs2

This software today has t0o many problem so you should not use it!!!

This guide describes how to mount a folder of the Swestore as a read/writeable folder in your local file-system.

Caveat

You need at least davfs 1.5.0 for download redirect support, see https://savannah.nongnu.org/bugs/?35428 for details.

Prerequisites

  • A *nix like Operating System, such as linux (possibly MacOS might work ... and possibly Windows as well, though this is not covered in this article yet).
  • The davfs2 package. On ubuntu, you can install it with:
    sudo apt install davfs2
    

Setup

Edit /etc/davfs2/davfs2.conf using your favourite text editor and add the following:

follow_redirect 1

This enables davfs to follow download redirects which improves performance and reduces load on central services.

Certificate authentication

Prerequisite: Client certificate in PKCS#12 format.

Copy the p12 cert to /etc/davfs2/certs/private, as root:

sudo cp MyCert.p12 /etc/davfs2/certs/private/

Edit /etc/davfs2/davfs2.conf, at the bottom, add the line:

clientcert                              MyCert.p12

Create a folder for mounting the filesystem:

sudo mkdir -p /swestore

Add the following line to /etc/fstab (e.g. at the end):

https://webdav.swestore.se:2443/  /swestore davfs uid=`<your-username>`,gid=`<your-accountname>`,rw,noauto 0 0

Mount, according to fstab, as root:

sudo mount /swestore

When asking for a username and password, just press (two times). On the third question, you are asked for the password you gave for the pkcs12 file, which you will have to type in, each time you mount this file system.

Done!

Now you should be able to browse to the mount point:

cd /swestore
ls -l

You chould be able to create files with content, and read the content:

echo "Testing testing 1 2 3 ..." > testfile.txt
cat testfile.txt

Note however, that you are not able to open the file for updating, with editors such as nano. Files in dCache are immutable.

More Hints

In order to automatically mount the system, you will need to download the server cert and the CA cert via Firefox, and then cat them into a single file, that you place in /etc/davfs2/certs, and then add the filename of it in /etc/davfs2/davfs2.conf like so:

servercert     myservercert.crt

(See this link for more info)

Also, you will need to add the user name and password (that you chose when generating the p12 file above) for your client certificate, to /etc/davfs2/secrets (read the help comments about how to do).

Back to top