Difference between revisions of "File Sharing with Webdav and DNSSD"

From ArchWiki
Jump to: navigation, search
(Configure the repositories)
(Configure the repositories)
Line 73: Line 73:
 
** DNSSDServiceName has the string that will be displayed in things like Nautilus for this service so the user will see "Music Repository" under Network.
 
** 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.
 
** 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.
 +
 +
DNSSDServiceTypes DNSSDServiceTypes _webdav._tcp _http._tcp
 +
 
** 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 "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.
 
** 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.

Revision as of 03:17, 11 January 2012

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 dbus-core

Edit /etc/rc.conf and add "avahi-daemon" and "dbus" to the daemons line.

Follow the configuration instructions for apache to where you test if 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

Add another directory for the webdav locks:

  • /home/DavLock

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

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

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

Edit /etc/httpd/conf/httpd.conf

3) add the following outside any declaration block:

DNSSDEnable On
DNSSDAutoRegisterVHosts On
DavLockDB /home/DavLock

4) enable the mod_dnssd module: add the following with all the other load module lines:

LoadModule dnssd_module modules/mod_dnssd.so

5) at the bottom of the file create a virtual host block

<Virtual Host *:80>


</VirtualHost>

6) In between the virtual host tags create a section for each repository as follows

<Directory /home/music>
  Options indexes Multiviews
  AllowOverride None
  Order allow,deny
  allow from all
</Directory>
Alias /music "/home/music"
<Location /music>
  Dav On
  DNSSDServiceName "Music Repository"
  DNSSDServiceTypes _webdav._tcp
  DNSSDServiceTxtRecord "path=/music"
  DNSSDServiceTxtRecord "u=Korah"
</Location>
  • 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.
DNSSDServiceTypes DNSSDServiceTypes _webdav._tcp _http._tcp
    • 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.

7) Add the fully qualified server name to the virtual host block. If you don't have a domain:

ServerName korah.local

if you do:

ServerName korah.home.singlespoon.org.au

Save the file and exit your editor.

Test that it is all working

1) Ensure that dbus and avahi are running

/etc/rc.d/dbus start
/etc/rc.d/avahi-daemon start

2) Ensure that apache is running with the current configuration

/etc/rc.d/httpd restart

3) Install dbus and the avahi-daemon on a workstation/desktop somewhere.

pacman -S dbus avahi

4) Start them:

/etc/rc.d/dbus start
/etc/rc.d/avahi-daemon start

5) Check that the services are discoverable:

avahi-discover

You should be able to see various entries to do with your server. Look for webdav shares. If you click on the ones you have created it will show you the parameters you set up.

7) Open Nautilus and browse the network. You should see the shares you have created. Click on them and they should mount.