HostOnNet Blog

Mounting WebDAV on Linux using Davfs

Looking for Linux Server Admin or WordPress Expert? We can help.

WebDAV stands for “Web-based Distributed Authoring and Versioning”.

It is a set of extensions to the HTTP protocol which allows users to collaboratively edit and manage files on remote web servers.

To mount a WebDAV file system on Linux, for example as backup drive, you need Davfs installed.

On CentOS 7, run

yum -y install davfs2

To access WebDAV file system, you need a WEBDAV_URL, WEBDAV_USERNAME and WEBDAV_PASSWORD.

Create a file /etc/davfs2/secrets

vi /etc/davfs2/secrets

Add following content

WEBDAV_URL WEBDAV_USERNAME WEBDAV_PASSWORD

Example

[root@ssd ~]# cat /etc/davfs2/secrets
https://webdav.hostonnet.com  hoston WSzBz09GO1VDtknp
[root@ssd ~]# 

Now create a folder, where you need to mount the WebDAV file system.

mkdir /backup

Now you can mount it with command

mount -t davfs WEBDAV_URL /MOUNTPOINT

Example

mount -t davfs https://webdav.hostonnet.com /hackup

To mount WebDAV on boot, edit /etc/fstab

vi /etc/fstab

Add

WEBDAV_URL /MOUNTPOINT davfs rw,uid=<System account>,gid=<System group>,file_mode=0660,dir_mode=0770 0 0

Example

[root@ssd ~]# cat /etc/fstab
proc /proc proc defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
/dev/md/0 none swap sw 0 0
/dev/md/1 /boot ext3 defaults 0 0
/dev/md/2   /   ext4    usrjquota=quota.user,jqfmt=vfsv0    0   0
https://webdav.hostonnet.com /backup davfs rw,uid=0,gid=0,file_mode=0660,dir_mode=0770 0 0
[root@ssd ~]#

Now run

mount -a

Posted in Linux

One Response to Mounting WebDAV on Linux using Davfs

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.