The Nextcloud web interface works for occasional uploads, but backup scripts, rsync jobs and desktop applications expect a filesystem path. WebDAV provides one: every Nextcloud user directory is available at a fixed HTTPS endpoint that Linux, Windows and macOS can mount as a drive. This tutorial covers the correct endpoint, app passwords, the mount procedure on all three platforms and how to verify the result.
What is Nextcloud WebDAV?
Nextcloud WebDAV is the HTTP-based file access protocol that Nextcloud exposes at https://<your-domain>/remote.php/dav/files/<username>/, letting Linux, Windows and macOS mount a user's files as a network drive without installing the desktop sync client.
The difference to the sync client matters: a WebDAV mount is remote access, not replication. Nothing is copied to local disk, so a mount costs no storage, but every read and write crosses the network. Nextcloud serves several DAV endpoints, and picking the wrong one is the most common setup error.
| Endpoint | Purpose |
|---|---|
/remote.php/dav/files/<username>/ |
Personal files of one user |
/remote.php/dav/ |
Root for files, calendars and contacts |
/remote.php/webdav |
Legacy alias, still functional |
/public.php/webdav |
Access to a public share link |
Use the first endpoint for a file mount and keep the trailing slash. The username in the path is the Nextcloud user ID, which is not always identical to the display name or the email address you log in with.
graph TD A["Linux: davfs2"] --> D["HTTPS 443, reverse proxy"] B["Windows: WebClient mini-redirector"] --> D C["macOS: mount_webdav"] --> D D --> E["Nextcloud: /remote.php/dav/files/USERNAME/"] E --> F["Auth: user plus app password"] F --> G["Primary storage: local disk or S3"]
Prerequisites
- Nextcloud 25 or newer, reachable over HTTPS with a certificate the client trusts
- A Nextcloud user account and its exact user ID
- Root or
sudoon the Linux client, local administrator rights on Windows - A server host that terminates TLS properly, for example a Nextcloud instance running on a scalable Cloud-VPS
Plain HTTP is not an option. WebDAV clients send credentials with Basic authentication on every request, and Windows refuses Basic authentication over unencrypted connections by default.
Why do you need an app password?
An app password is a per-device token you generate in Nextcloud under Settings → Security → Devices & sessions, and WebDAV clients need one whenever two-factor authentication is enabled, because those clients cannot complete the second factor.
Generate one token per client machine. If a laptop is lost, revoke that single token in the same dialog instead of changing the account password everywhere. Nextcloud displays the token once, in groups separated by hyphens. Copy it before closing the dialog.
Even without 2FA, an app password is the better choice: it never grants access to the admin settings, and it shows up in the session list with a name you assign.
Matching infrastructure at centron
No hardware needed to follow along: ccloud³ VMs with full root access, billed by the hour and ready in seconds. Rent a cloud server →
Mount Nextcloud on Linux with davfs2
Install davfs2, which provides the mount.davfs helper and a FUSE-based filesystem driver:
$ sudo apt update
$ sudo apt install -y davfs2On RHEL-based systems the package comes from EPEL: sudo dnf install -y davfs2.
Store the credentials so the mount does not prompt interactively. Write one line per endpoint into /etc/davfs2/secrets:
https://cloud.example.com/remote.php/dav/files/alice/ alice xxxxx-xxxxx-xxxxx-xxxxx-xxxxxThe URL in the secrets file must match the URL you mount character for character, trailing slash included. Restrict the file, because it holds a usable token:
$ sudo chmod 600 /etc/davfs2/secretsCreate the mount point and mount it once by hand:
$ sudo mkdir -p /mnt/nextcloud
$ sudo mount -t davfs https://cloud.example.com/remote.php/dav/files/alice/ /mnt/nextcloudMount on demand via /etc/fstab
Add an entry so the mount survives reboots and can be triggered by an unprivileged user:
https://cloud.example.com/remote.php/dav/files/alice/ /mnt/nextcloud davfs _netdev,noauto,user,uid=1000,gid=1000,file_mode=0664,dir_mode=0775 0 0The user option only works if the mount.davfs binary is SUID root. Enable that and add your account to the davfs2 group:
$ sudo dpkg-reconfigure davfs2
$ sudo usermod -aG davfs2 $USER
$ mount /mnt/nextcloudLog out and back in for the group membership to apply. For unattended systems, replace noauto,user with x-systemd.automount,x-systemd.idle-timeout=600 so systemd mounts the share on first access and releases it when idle.
Tune the davfs2 cache
By default davfs2 requests WebDAV locks before writing. Nextcloud handles locks, but editors that save in many small steps produce lock churn and visible stalls. Add a mount-point section to /etc/davfs2/davfs2.conf:
[/mnt/nextcloud]
use_locks 0
cache_size 512
table_size 4096use_locks 0 disables lock requests and removes most write latency. Do not use it when several machines write to the same directory at the same time. cache_size is the local cache in MiB under /var/cache/davfs2; a file larger than the cache cannot be written, so size it above your largest expected upload.
Mount Nextcloud on Windows
Windows mounts WebDAV through the WebClient service, also called the mini-redirector. On Windows Server the service is not installed by default. Make sure it runs and starts automatically:
Set-Service -Name WebClient -StartupType Automatic
Start-Service WebClientThen map the endpoint to a drive letter from an elevated command prompt:
net use Z: https://cloud.example.com/remote.php/dav/files/alice/ /user:alice xxxxx-xxxxx-xxxxx-xxxxx-xxxxx /persistent:yesIf the HTTPS form is rejected, use the UNC notation with the @SSL suffix, which forces port 443:
net use Z: \\cloud.example.com@SSL\DavWWWRoot\remote.php\dav\files\alice /user:aliceRaise the 50 MB transfer limit
The mini-redirector aborts transfers larger than 50,000,000 bytes with error 0x800700DF. Raise the limit to the 4 GiB maximum and restart the service:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\WebClient\Parameters" -Name FileSizeLimitInBytes -Value 4294967295 -Type DWord
Restart-Service WebClientFiles above 4 GiB cannot be transferred through a mapped WebDAV drive at all. Use the Nextcloud desktop client or curl for those, since both support chunked uploads.
Mount Nextcloud on macOS
In Finder, press Command+K, enter https://cloud.example.com/remote.php/dav/files/alice/ and authenticate with the user ID and the app password. The share appears under /Volumes/.
From the terminal, use mount_webdav. The -i flag prompts for the credentials and stores them in the keychain:
$ mkdir -p ~/nextcloud
$ mount_webdav -i -v nextcloud https://cloud.example.com/remote.php/dav/files/alice/ ~/nextcloudmacOS writes .DS_Store files into every directory it browses, which clutters the Nextcloud file list and triggers sync activity for other users. Disable that behaviour for network volumes:
$ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
$ killall FinderUnmount with umount ~/nextcloud or by ejecting the volume in Finder.
How do you verify the WebDAV mount works?
Verify a WebDAV mount by writing a test file to the mount point and confirming that the endpoint answers a PROPFIND request with HTTP status 207 Multi-Status, which proves that both the network path and the credentials are correct.
Check the mount itself first:
$ mount | grep davfs
https://cloud.example.com/remote.php/dav/files/alice/ on /mnt/nextcloud type fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
$ echo webdav-check > /mnt/nextcloud/webdav-check.txt
$ ls -l /mnt/nextcloud/webdav-check.txtThe file must appear in the Nextcloud web interface within a few seconds. Then test the endpoint independently of any mount driver:
$ curl -s -o /dev/null -w '%{http_code}\n' -u alice:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx -X PROPFIND -H 'Depth: 1' https://cloud.example.com/remote.php/dav/files/alice/
207A 207 confirms the endpoint and the credentials. A 401 means authentication failed, a 404 means the user ID in the path is wrong, and a 301 usually means you omitted the trailing slash or used http://.
Troubleshooting
HTTP 401 despite correct credentials. Two-factor authentication is active on the account, or the URL in /etc/davfs2/secrets differs from the mounted URL. Generate an app password and compare both strings including the trailing slash. Check Received status 401 lines in journalctl -t mount.davfs.
Windows reports "The network name cannot be found". The WebClient service is stopped or the certificate is not trusted. Start the service with Start-Service WebClient, then open the HTTPS URL in Edge once; if the browser warns about the certificate, the mini-redirector will refuse the connection as well.
Writes hang or time out on Linux. WebDAV locking or an undersized cache is the usual cause. Set use_locks 0 and raise cache_size in /etc/davfs2/davfs2.conf, then remount. On the server side, check that the reverse proxy allows a request body large enough for your files, for example client_max_body_size 10G in nginx.
Files reappear after deletion. The mount points at a directory that is a shared or group folder. Deletions there depend on the share permissions granted to the user, not on the mount options.
Wrap-up
A WebDAV mount turns a Nextcloud account into a normal path for scripts and applications, at the cost of network latency on every operation. Keep one app password per client, disable locking only where a single machine writes, and use the desktop client or chunked uploads for files above a few gigabytes. For scheduled backups, mount with x-systemd.automount so a temporary server outage fails the job instead of blocking the boot process.
Read next
- Back Up and Restore Nextcloud: Data, Database, Config
- Install Nextcloud All-in-One with Docker
- Install Nextcloud on Ubuntu 24.04 with nginx
- Nextcloud vs ownCloud vs Seafile: Which One Fits?
- Run Nextcloud with Docker Compose
- Set Up Nextcloud Office: Collabora or OnlyOffice
- Updating Nextcloud: Web Updater, occ and a Rollback Plan
- What Is Nextcloud? Architecture, Components and Use Cases
- Which Server for Nextcloud? Sizing RAM, CPU and Storage
Testen Sie Ihr Setup auf ccloud³
Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.