Davfs Webdisk in Debian
February 12, 2019QRG on install of davfs in Debian for mounting Webdisks (the type in CPanel on webhosting)
DAVFS related installs
apt-get install davfs2
Add in /etc/fstab
https://webdav.example:port/path /mnt/webdav davfs 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.
Note that noauto indicates that at boot, or by calling ‘mount -a’, this will NOT be automatically mounted. Convenient to avoid hangs if the server is offline.
Instead you would mount it as root, explicitly with ‘mount /mnt/webdav’.
Webdisk Password and Username
You can test permissions by mounting directly from shell.
mount -t davfs https://xxx.yyy.com:2078/ /mnt/webdav
This will prompt for a username and password. If mounted check the list of files in /mnt/webdav to be sure. Also you may have to change the default directory in your cPanel setup if pointing somewhere non-existent or in the wrong place.
However when using fstab you’ll have to supply the username/pass in a seperate file…
sudo nano /etc/davfs2/secrets
Add the line in the format….
/mnt/webdav username_here password_here
Alternatively you can replace the mount point in the secrets file with the web-address, but if it ever changes then you need to change it in two places (fstab and secrets).
This is a good resource for additional help: https://wiki.archlinux.org/title/Davfs2
Errors with writing to DAVFS2
You may have to add (/uncomment) the following lines to /etc/davfs2/davfs2.conf if you are having file writing errors:
use_locks 0 if_match_bug 1
See: https://bugs.launchpad.net/ubuntu/+source/davfs2/+bug/466960