davfs2

davfs2 is a Linux file system driver that allows to mount a WebDAV resource. WebDAV is an extension to HTTP/1.1 that allows remote collaborative authoring of Web resources.

Installing davfs2

Install the davfs2AUR package.

Mount WebDAV-resource

Configuration and mount options

There is a system wide configuration file /etc/davfs2/davfs2.conf and a user configuration file ~/.davfs2/davfs2.conf. The latter is read in addition to the system configuration when invoked by an ordinary user and takes precedence. There are general, WebDAV related, cache related and debugging options. All the available options and their syntax can be found in davfs2.conf(5).

There are also mount options used to define if needed the path of the configuration file, the owner and group of the filesystem and some other options related to file access. The list of recognised options can be obtained with the following command:

$ mount.davfs -h

Also see mount.davfs(8) for description and options.

Using command-line

To mount a WebDAV-resource use mount, not mount.davfs directly.

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

Using systemd

To use systemd mounting:

You can create an systemd automount unit to set a timeout

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

Using fstab

To define how the webdav resource should be mounted into the filesystem, append a fstab entry under the following format:

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. _netdev mount option could be used to automount network drives.

Tips and tricks

Storing credentials

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

Make sure the secrets file contains the correct permissions, for root mounting:

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

And for user mounting:

$ 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 and mount options to use as option. Default for this parameter is which locks files on the server when they are opened for writing.

Password in secrets file

Be careful for special characters in passwords such as and . Escape them with .

Network is online but domain lookup fails

Sometimes is reached but the domain of your WebDAV server still cannot be found: you can wait until the name lookup succeeds manually.

First, you need to set up using fstab. Then, for 15 seconds we test if we can reach the server with ping and only try to mount once successful:

This is better used as user unit.

gollark: Most sites - blogs and such - can work fine mostly-statically.
gollark: It would probably help if you explain:- what you're trying to do- what web framework and language you're using- what this application actually is
gollark: > For example, on POSIX:> `path.normalize('/foo/bar//baz/asdf/quux/..');`> `// Returns: '/foo/bar/baz/asdf'`
gollark: > The path.normalize() method normalizes the given path, resolving '..' and '.' segments.
gollark: node.js calls it "normalizing", which is probably the word I meant, see here: https://nodejs.org/api/path.html#path_path_normalize_path

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.