Mount files from a WebDAV server in a local directory

If you have a server with Owncloud installed, you probably have access to it through WebDAV. You can use the command line with cadaver or mount it as a local directory with davfs2.

The Davfs article on ArchWiki is well explained:

Add yourself to the network group:

# usermod -a -G network <user>

Restart your session, and add the following entry in /etc/fstab:

https://owncloud.yourserver.com/remote.php/webdav/ /home/<user>/Owncloud davfs user,noauto,uid=,file_mode=600,dir_mode=700 0 1

Edit ~/.davfs/secrets and add your credentials like this:

"https://owncloud.yourserver.com/remote.php/webdav/" "webdavuser" "webdavpassword"

Note that the double quotes are not required, but if your password contains special characters, it may help.

Now you should be able to mount and unmount ~/Owncloud with:

$ mount ~/Owncloud
$ fusermount -u ~/Owncloud