textshape

A Knowledge Worker's Notebook

I used to be a technical writer when I created this website. I have moved on now.

5.jpg

Setting up a WebDAV File System

One of the websites I'm responsible for changed the upload area of its live server to a secured WebDAV share.

At first I thought, OK, no problem, I'll just choose WebDAV in Dreamweaver's Remote Site dialog, and I'm done. Not quite so, as it turned out. The WebDAV share I wanted to connect to was only accessible via https using a certificate. And even though the documentation didn't say so, Dreamweaver 8 only seems to support WebDAV uploads via http.

So I had to look for other ways to access the WebDAV share. I decided to set up a davfs2 file system on my Linux computer, and then mount the remote WebDAV share.

Prerequisites

Procedure

  1. Install fuse-davfs2 using yum.
  2. Create a davfs2 operating system user group and add the following users to this group:
    root, <local_user>
  3. Create a local directory for mounting the WebDAV share later:
    <local_mount_directory>
  4. In /etc/updatedb.conf, exclude this directory from indexing by updatedb.
  5. Enter this directory into the /etc/fstab file:
    https://<webdav_share> <local_mount_directory> davfs user,noauto 0 0
  6. Enter the following information in the /etc/davfs2/davfs2.conf file:
    	# General Options
    	# ---------------
    	dav_user      <local_user>    # system wide config file only
    	dav_group     davfs2          # system wide config file only
    	
    	# WebDAV Related Options
    	# ----------------------
    	servercert      <public_key>.pem
    	clientcert      <private_key>.p12
    	ask_auth        1
    
  7. Copy the following files (and subdirectories) into the ~/.davfs directory:
    /etc/davfs2/davfs2.conf
    /etc/davfs2/secrets
    /etc/davfs2/certs/<public_key>.pem
    /etc/davfs2/certs/<private_key>.p12
  8. Change the permissions for your private key:
    chmod 600 <private_key>.p12
  9. Change to the ~/.davfs/certs/private/ directory.
  10. To mount the remote WebDAV share, enter the following command:
    mount <local_mount_directory>

    Please enter the username to authenticate with proxy
    proxy.xxx.xxx or hit enter for none.
    Username: [ENTER]
    Please enter the password to authenticate user anonymous with server
    https://<webdav_share> or hit enter for none.
    Password: [ENTER]
    /sbin/mount.davfs: the server certificate is not trusted
    issuer: XXXX
    subject: XXXX
    identity: XXXX
    fingerprint: xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
    You only should accept this certificate, if you can
    verify the fingerprint! The server might be faked
    or there might be a man-in-the-middle-attack.
    Accept certificate for this session? [y,N] y
     

Result

You can now access the WebDAV share via the normal file explorer.

Remember to unmount the WebDAV share after you have finished uploading your files using the umount command.

for layout purposes