Difference between revisions of "Davfs"

From ArchWiki
Jump to: navigation, search
m (format)
(Creating/copying files not possible: Added freezes)
 
(34 intermediate revisions by 14 users not shown)
Line 1: Line 1:
 
[[Category:File systems]]
 
[[Category:File systems]]
'''DAVfs''' is a Linux file system driver that allows you to mount a WebDAV server as a disk drive. WebDAV is an extension to HTTP/1.1 that allows remote collaborative authoring of Web resources, defined in RFC 4918.
+
[[ja:Davfs]]
 +
'''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 ==
 
== Installing DAVfs ==
  
[[pacman|Install]] {{Pkg|davfs2}} from [[official repositories]].
+
[[Install]] {{Pkg|davfs2}} from [[official repositories]].
  
==Mounting the partition==
+
== Mount WebDAV-resource ==
Examples:
+
To list all available mount options:
  # mount.davfs http://localhost:8080/ /mnt/dav
+
  $ mount.davfs -h
# mount -t davfs http://localhost:8080/ /mnt/dav
 
  
==Mounting as regular user==
+
Configuration files are stored under {{ic|/etc/davfs2/davfs2.conf}} and/or {{ic|~/.davfs2/davfs2.conf}}.
  
Add yourself to network group:
+
=== Using command-line ===
  # usermod -a -G network username
+
# mount.davfs http(s)://address:<port>/path /mount/point
 +
  # mount -t davfs http(s)://addres:<port>/path /mount/point
  
Add webdav entry to /etc/fstab:
+
=== Using systemd ===
https://webdav.example.com /home/username/webdav davfs user,noauto,uid=username,file_mode=600,dir_mode=700 0 1
+
To use [[systemd#Mounting|systemd mounting]]:
  
Create secrets file in your home:
+
{{hc|/etc/systemd/system/mnt-webdav-service.mount|<nowiki>
# mkdir ~/.davfs2/
+
[Unit]
# echo "https://webdav.example.com webdavuser webdavpassword" >> ~/.davfs2/secrets
+
Description=Mount WebDAV Service
# chmod 0600 ~/.davfs2/secrets
+
After=network-online.target
 +
Wants=network-online.target
  
Now you should be able to mount and unmount ~/webdav:
+
[Mount]
  # mount ~/webdav
+
What=http(s)://address:<port>/path
# fusermount -u ~/webdav
+
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
 +
</nowiki>}}
 +
 
 +
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 {{ic|~/.davfs2/secrets}} for ''user'', and {{ic|/etc/davfs2/secrets}} for ''root'':
 +
 
 +
{{hc|/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 [[#Mount_WebDAV-resource|configuration file]] to use {{ic|use_locks 0}} as option.
 +
 
 +
== See also ==
 +
 
 +
*http://doc.owncloud.org/server/6.0/user_manual/files/files.html
 +
*http://ajclarkson.co.uk/blog/auto-mount-webdav-raspberry-pi/

Latest revision as of 08:49, 26 July 2017

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