Set Up WebDav for Owncloud

WebDAV (Web Distributed Authoring and Versioning) allows "mounting" owncloud content as a local mountpoint. This can be nice if you prefer to access your owncloud data as needed rather than using the owncloud client to keep your local copy in sync with your owncloud server.

The following steps should get you up and going with webdav access to your owncloud server:
note: no changes should be needed to your owncloud server.

  • Install davfs2
    $ apt-get install davfs2
  • Setup your owncloud credentials in the davfs2 secrets file (/etc/davfs2/secrets)
    ...
    "https://your-owncloud-server-url.com/owncloud/remote.php/webdav"   yourUserName   "your password here"
    ...
  • Create a mountpoint
    $ mkdir /media/owncloud
    $ chown localUserId:localUserId /media/owncloud
  • Add mount command to fstab (/etc/fstab)
    ...
    https://your-owncloud-server-url.com/owncloud/remote.php/webdav/  /media/owncloud   davfs   defaults,user,noauto,uid=1000,gid=1000  0       0 #adjust auto/noauto and uid/gid as needed
    ...
  • Add localuser to the davfs2 group
    $ adduser localUserId davfs2
    note: you will need to log out and back in after this to get your new group to take effect

Now all you need to do is issue the following command to mount your owncloud webdav instance:
$ mount /media/owncloud

To unmount:
$ umount /media/owncloud

If you happen to get the following error/message "/sbin/mount.davfs: program is not setuid root" then you will need to setuid for it as follows:
$ sudo chmod u+s /sbin/mount.davfs