File Sharing with Webdav and DNSSD

From ArchWiki
Revision as of 13:56, 9 January 2012 by Kynikos (Talk | contribs) (standard header)

Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Say you need a location that you can use to store things: eg music, photos, books etc. Say you want Nautilus and other file managers to find this automatically. You could use Samba or you could do the following which uses webdav and dnssd on a server.

Install the required packages

pacman -S apache mod_dnssd avahi.

Follow the configuration instructions for apache to where you test it is running. Once it is working continue.

Configure the repositories

1) Create one or more directories - one for each repository eg:

  • /home/music
  • /home/photos
  • /home/books

They can be anywhere but the instructions below will assume they follow the above. Note it is a good idea to keep them together so that it is easy to backup.

2) change the ownership to http and permissions so apache can access them:

chown -R http:nobody /home/music
chmod -R 700 /home/music

3) enable the mod_dnssd module

a2enmod mod-dnssd

4) Edit the httpd.conf and add the following outside any declaration block:

DNSSDEnable On
DNSSDAutoRegisterVHosts On

5) Create a section for each repository as follows or the httpd-vhosts.conf file depending on whether you are having multiple hosts. If you are configuring multiple hosts place them in the virtual host block they refer to.

<Directory /home/music>
  Options indexes Multiviews
  AllowOverride None
  Order allow,deny
  allow from all
Alias /music "/home/music"
<Location /music>
  Dav On
  DNSSDServiceName "Music Repository"
  DNSSDServiceTypes _webdav._tcp
  DNSSDServiceTxtRecord "path=/music"
  DNSSDServiceTxtRecord "u=Korah"
  • The directory block is pretty standard for no security and browsing of the directory. Check apache documentation for alternatives.
  • The Alias statement is also pretty standard it links the url ending in /music to the directory /home/music
  • The Location block sets up webdav to share the directory and DNSSD so that things like nautilus and avahi-discover can find it.
    • DNSSDServiceName has the string that will be displayed in things like Nautilus for this service so the user will see "Music Repository" under Network.
    • DNSSDServiceTypes are the service types we are broadcasting. If you want them to be aware of these directories as web folders browsable by a web browser add "_http._tcp" with a space between them.
    • DNSSDServiceTxtRecord "path=/music" this is the part of the URL after the fully qualified domain name. It is required for the service to be correctly broadcast and shared
    • DNSSDServiceTxtRecord "u=Korah". This specifies the username. I used my server name but "Anon" also works but it must be included to work. Otherwise when you click on the icon in nautilus it won't mount. The other txt record is "p" for password but I didn't need to use that.

Repeat this block for each repository you are setting up.

6) Somewhere you need to declare the fully qualified domain name of this server. If it is a virtual host then in the virtual host block. If it is a single server then outside any other block. If you don't have a domain name try something like:

ServerName korah.local

if you do: