WebDAV for Linux - Advanced
If two-factor authentication is enabled, you must use an application password to connect to your mailbox Drive via WebDAV. The regular password for your mailbox account will not work in this case.
For more information, see the article Application passwords for external programs.
Setup – Step by step
In this advanced user guide, you will learn how to set up mailbox Drive on the Linux operating system and mount it as a local directory. The following steps are performed in the Linux terminal. You will also need a text editor to modify configuration files.
Here are the instructions for an easier approach: Setting up Drive as a folder in Linux with WebDAV – Easy
Step 1: Preparation
If davfs2 is not installed, install it using the Software Manager or the terminal.
| Distribution | Installation command |
|---|---|
| Debian / Ubuntu | sudo apt install davfs2 |
| Fedora | sudo dnf install davfs2 |
| Arch Linux | sudo pacman -S davfs2 |
Step 2: Editing the “fstab” file
Navigate to the /etc directory:
cd /etc
Open the fstab file with a text editor (we'll use nano as an example here). Enter your root password:
sudo nano fstab
Add the following line at the end of the configuration file:
https://dav.mailbox.org/servlet/webdav.infostore/Userstore /media/drive davfs noauto,user,rw 0 0
Step 3: Configuring the “davfs2” file
Navigate to the davfs2 directory:
cd /etc/davfs2
Open the davfs2.conf file with a text editor:
sudo nano davfs2.conf
Adjust the following configuration parameters or add them if they do not already exist:
| Parameter | Value | Description |
|---|---|---|
if_match_bug | 1 | Enables compatibility mode for certain WebDAV servers. |
use_locks | 0 | Disables file locking to prevent access conflicts. |
cache_size | 50 | Sets the size of the local cache in MB. |
table_size | 4096 | Size of the internal file allocation table |
delay_upload | 10 | Enables delayed uploads to improve performance. |
gui_optimize | 1 | Optimizes usage with graphical user interfaces. |
buf_size | 64 | Sets the size of the local buffer in KB. |
Any other configuration lines that you do not need or do not want to overwrite should be commented out by adding a # at the beginning of the line. This ensures that only the intended settings are active.
Now assign ownership rights to the davfs2.conf file. Replace username with your actual username. If you are unsure of your username, you can find it by using the following command:
whoami
Command to set the correct permissions:
sudo chown -Rv root:username davfs2.conf
Storing mailbox username and password locally
Open the file /etc/davfs2/secrets with a text editor.
sudo nano secrets
Add the following line to the secrets file:
/media/drive username@mailbox.org password
Replace username@mailbox.org and password with your login credentials for your mailbox account.
If your password contains special characters or spaces, we recommend enclosing it in double quotes. If two-factor authentication is enabled, use your Application passwords for external programs.
To protect the secrets file from unauthorized read access, set the appropriate permissions. Use the following command to do so:
sudo chmod 400 /etc/davfs2/secrets && sudo chown -Rv root:root secrets
Step 4: Configuring WebDAV access
Create the /media/drive directory using the following command:
sudo mkdir -p /media/drive
Now assign ownership to this directory using the command to set permissions:
sudo chown -Rv $USER:$USER /media/drive
Test I
You can now run an initial test:
sudo mount -t davfs /media/drive
If this command executes without errors, your mailbox Drive is now available locally on your computer.
This is how you can view the contents:
ls /media/drive
To complete the test, unmount the Drive now:
sudo umount -t davfs /media/drive
Customising user permissions
Allow the non-privileged user you normally work with to mount the drive. Add the user to the davfs2 group.
sudo usermod -aG davfs2 $USER
Test II
You can now run a second test:
mount /media/drive
If this command runs without sudo and without any errors, your mailbox Drive is now available locally on your computer.
This is how you can view its contents:
ls /media/drive
If an unknown error occurs, restart the system if necessary, and then check whether your username is a member of the davfs2 group. To do this, use the following command:
groups $USER
If the following error occurs: "/sbin/mount.davfs: the program file does not have the setuid bit set: The argument is invalid", use the following command and then run Test II again.
sudo chmod u+s /sbin/mount.davfs
To complete Test II, now unmount the Drive:
umount /media/drive
Step 5: Automatic mount on Linux startup
To automatically mount the directory every time the system restarts, add the following command to your startup settings or under “Startup Programs.” After restarting Linux, the mailbox Drive should be accessible in a file manager at /media/drive.
mount /media/drive
Open the mount.desktop file with a text editor.
nano /home/$USER/.config/autostart/mount.desktop
Add the following line to the mount.desktop file:
[Desktop Entry]
Exec=mount /media/drive
Icon=
Name=mount
Path=
Terminal=True
Type=Application
Name[de_DE]=mailbox Drive
Alternatively, you can configure the settings for “Automatic Mount on Linux Startup” using the graphical user interface.

Automatic mounting at Linux startup, using GNOME as an example
Saving the Drive as a bookmark
To save the Drive as a bookmark in your file manager:
-
In the address bar of your file manager, open the folder
/media/drive—in this example, “Dolphin” is used. -
Right-click on the corresponding folder — in this example, “Maxima Mustermann.”
-
Click Add to Places.

Drive as a bookmark -
You can rename the folder. To do so, right-click on your mounted folder “Maxima Mustermann.”
-
Enter any name you like, e.g., “mailbox Drive.”

Rename bookmark
Done!
