This page looks best with JavaScript enabled

Set Up WebDav for Owncloud/Nextcloud

 ·  ☕ 2 min read

Background

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.

Details

The following steps should get you up and going with WebDAV access 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 to mount the WebDAV directory with: $ 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

Notes

  • No changes should be needed to your Owncloud server.
  • 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
Share on

drad
WRITTEN BY
drad
Sr. Consultant