Davfs

From ArchWiki
Jump to: navigation, search

DAVfs is a Linux file system driver that allows you to mount a WebDAV resource. WebDAV is an extension to HTTP/1.1 that allows remote collaborative authoring of Web resources, defined in RFC 4918.

Installing DAVfs

Install davfs2 from official repositories.

Mount WebDAV-resource

To list all available mount options:

$ mount.davfs -h

Configuration files are stored under /etc/davfs2/davfs2.conf and/or ~/.davfs2/davfs2.conf.

Using command-line

# mount.davfs http(s)://address:<port>/path /mount/point
# mount -t davfs http(s)://addres:<port>/path /mount/point

Using systemd

To use systemd mounting:

/etc/systemd/system/mnt-webdav-service.mount
[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,gid=1000,file_mode=0664,dir_mode=2775,grpid
Type=davfs
TimeoutSec=15

[Install]
WantedBy=multi-user.target

See Fstab#Automount with systemd for more tips and tricks when using systemd mount units.

Using fstab

Append the following fstab entry:

https://webdav.example/path /mnt/webdav davfs uid=username,file_mode=0664,dir_mode=2775 0 0

To mount as user, add yourself to the network group. Replace username with the name of the user:

# gpasswd network -a username

Mount as user example:

https://webdav.example/path /mnt/webdav davfs user,noauto,uid=username,file_mode=0664,dir_mode=2775 0 0

Tips and tricks

Storing credentials

Create a secrets file to store credentials for a WebDAV-service using ~/.davfs2/secrets for user, and /etc/davfs2/secrets for root:

/etc/davfs2/secrets
http(s)://address:<port>/path username password

Make sure the secrets file contains the correct permissions:

# chmod 600 /etc/davfs2/secrets
# chown root:root /etc/davfs2/secrets

For user mouting:

$ chmod 600 ~/.davfs2/secrets

Troubleshooting

Creating/copying files not possible and/or freezes

If creating/copying files is not possible and/or freezes occur, edit the configuration file to use use_locks 0 as option.

See also