Tuesday, May 6, 2008

Family data-center: file sharing

One of the joys of Linux is easy, well, relatively easy anyway, setup of Internet services.

Todays service is webdav, a file sharing protocol for the Internet based on HTTP. You will need a Internet connected Linux box that you can connect to somehow through the use of dynamic DNS or some such. My home based Internet server is an oooold laptop running Debian Etch (PII, 366MHz, 190MB, 10GB disk). Very easy to maintain, upgrade and install new stuff on. I will assume you use a modern Linux distribution in the following, and also assume that it's Debian.

Next you need Apache, and to enable the modules dav and dav_fs. On most Linux machines you can run these commands as root: "a2enmod dav; a2enmod dav_fs". And create the directory dav under the Apache Document Root to store files in. Often this will be /var/www/dav . It must be owned by the user Apache runs as, on debian that's the "www-data" user: "chown www-data /var/www/dav".

Now configure Apache. In /etc/apache2/conf.d create a new file called dav.conf:

Order Allow,Deny
Allow from all

Dav On

AuthType Basic
AuthName "Langfeldt.net WebDav"
AuthUserFile /etc/davpasswd
Require valid-user

This sets up access control for the directory and enables DAV in it. The password file is created by the htpasswd command as root. To create a first account called "janl" run "htpasswd -c /etc/davpasswd janl". For subsequent accounts or password changes drop the "-c" option. If you take out your web browser and direct it to http://yourserver/dav" you should be greeted by a password dialog. Your browser should then show a mostly empty directory listing. Firefox can only show webdav directories, but the KDE "konqueror" is able to also copy files into a webdav directory. In konqueror the URL is "webdav://yourserver/dav" or "webdavs://yourserver/dav" if you have SSL on the web server. You can use webdav with Gnome too of course.

Now you can store files on the webdav volume and access it from anywhere in the world, whenever. in.solit.us has a useful help page at http://in.solit.us/about/webdav .

That's all for today. I'll return with something that may give you more cred with the wife: family calendar services.

No comments: