Wed, 19 Apr 2006
Gnome User Share
In order to explore Avahi a bit further I have decided to find out how the file sharing with Avahi works. I was surprised how simple, elegant, and UNIXish it is:
There is only one simple app needed, the gnome-user-share package (already available in Fedora Core 5). It is then possible to enable and disable sharing (System -> Preferences -> Personal File Sharing), set up a password for reading and/or writing to the share, and that's it. Shared files should be put to the ~/Public directory, and they are immediately visible by other clients (either with Apple systems, or with Linux, using Computer -> Network in Nautilus).
It works the following way: gnome-user-share (which is a very tiny application - 80KB including several message catalogs), has its own minimal Apache configuration file, and it simply starts Apache on a random unprivileged port, with DocumentRoot in the user's ~/Public directory, and with only WebDAV supported. It then publishes the information about the share (name and port number) using Avahi. So the other users can see a new WebDAV share, and can read (and, if needed, also write) this directory. Nothing special, but it is very smart and elegant way to glue existing tools (Apache and Avahi) to do something completely new.
That said, it surely can be improved: the ~/Public directory (if not present) should be created on demand when user enables the sharing, and probably its icon should be placed on a desktop. The directory could also have a special item for disabling/enabling the share in its Properties, and maybe even two alternative icons showing the current state. Also the name of the share can be something better than login's public files (at least use the full name/GECOS field instead of the login name here).