Mounting WebDAV on Linux
This document describes how to mount WebDAV shares on Linux systems using davfs2, with Ubuntu 24.04 as an example.
Installing davfs2
Run the following command in the terminal to install the davfs2 package:
|
|
During installation, you may be prompted whether to allow non-root users to mount WebDAV. You can use the arrow keys to switch to the “Yes” option.
Creating a Mount Point Directory
Create a directory to serve as the mount point:
|
|
Configuring davfs2
Edit the davfs2.conf file to configure davfs2. Open the configuration file:
|
|
Find the use_locks configuration option in the file and ensure its value is set to 0. This disables file locking, as some WebDAV servers do not support locking.
|
|
Save and close the file (press Ctrl+X, then press Y, and finally press Enter).
Configuring the davfs2 secrets File
Create a secrets file to store the username and password for the WebDAV server. Run the following command in the terminal:
|
|
Add a line similar to the following, replacing it with your WebDAV server’s username and password:
|
|
Replace the content in the above line with your actual information:
http://your-webdav-url- Your WebDAV server addressusername- Your usernamepassword- Your password
Save and close the file.
Setting File Permissions
To ensure the password in the secrets file is secure, set the file permissions:
|
|
Mounting the WebDAV Share
Use the mount command to mount the WebDAV share to the previously created mount point:
|
|
Automatic Mounting on Boot (Optional)
If you need to mount automatically on boot, you can edit the /etc/fstab file:
|
|
Add the following line:
|
|
Unmounting the WebDAV Share
When you need to unmount, run:
|
|