Configuration and mount options
There is a system wide configuration file
/etc/davfs2/davfs2.conf and a user configuration file
~/.davfs2/davfs2.conf. The latter is read in addition to the system configuration when invoked by an ordinary user and takes precedence. There are general, WebDAV related, cache related and debugging options. All the available options and their syntax can be found in .
There are also mount options used to define if needed the path of the configuration file, the owner and group of the filesystem and some other options related to file access. The list of recognised options can be obtained with the following command:
$ mount.davfs -h
Also seefor description and options.
To mount a WebDAV-resource use
# mount -t davfs http(s)://addres:<port>/path /mount/point
To use systemd mounting:
[Unit] Description=Mount WebDAV Service After=network-online.target Wants=network-online.target [Mount] What=http(s)://address:<port>/path Where=/mnt/webdav/service Options=uid=1000,file_mode=0664,dir_mode=2775,grpid Type=davfs TimeoutSec=15 [Install] WantedBy=multi-user.target
You can create an systemd automount unit to set a timeout
[Unit] Description=Mount WebDAV Service [Automount] Where=/mnt/webdav/service TimeoutIdleSec=300 [Install] WantedBy=remote-fs.target
See Fstab#Automount with systemd for more tips and tricks when using systemd mount units.
https://webdav.example/path /mnt/webdav davfs rw,user,uid=username,noauto 0 0
where username is the owner of the mounted file system. It may be a numeric ID or a user name and only root can mount a uid different from the mounting user.
_netdev mount option could be used to automount network drives.
Tips and tricks
Create a secrets file to store credentials for a WebDAV-service using
~/.davfs2/secrets for user, and
/etc/davfs2/secrets for root:
https://webdav.example/path davusername davpassword
Make sure the secrets file contains the correct permissions, for root mounting:
# chmod 600 /etc/davfs2/secrets # chown root:root /etc/davfs2/secrets
And for user mounting:
$ chmod 600 ~/.davfs2/secrets
Creating/copying files not possible and/or freezes
If creating/copying files is not possible and/or freezes occur, edit the #Configuration and mount options to use
use_locks 0 as option.
Default for this parameter is
1 which locks files on the server when they are opened for writing.
Password in secrets file
Be careful for special characters in passwords such as \ and ". Escape them with \.