My *nix world

Editing files over www

Editing files over www? Yes, that's right. In fact Sir Tim Berners Lee - the WorldWideWeb's inventor - had the vision of a read/write World Wide Web (www) not read-only as we know it today. The idea behind the WWW was to facilitate an environment where the user can both share and edit documents over Internet. As the Internet grew it become a real necessity to have a read-only access to web pages (no one wants to have his/her web-pages altered by someone else,right?).

In order to honour Tim Berners Lee's original vision someone had to write a new protocol that works over WWW which allows us to create,read,update,delete (CRUD) information over Internet. The protocol calls Web Distributed Authoring and Versioning (WebDAV) which is, to quote from

[..] is an extension of the Hypertext Transfer Protocol (HTTP) that facilitates collaboration between users in editing and managing documents and files stored on World Wide Web servers.

How it works?

Just imagine a network share where you can add/change/view/delete documents. Just imagine that you can access that location via the Windows Explorer or whatever file manager application you might have. So basically the result of a WebDAV installation is that you can access such location right in your default file manager (eg. Windows Explorer on Windows, Thunar on Linux with XFCE, Nautilus on Linux with GNome, Finder on Mac OS X, etc) and furthermore, it works over HTTP (ie. by default port 80). If you ask me what is the difference between this protocol and FTP then the short answer is that although they do pretty much the same thing, how they do it is what make them different. WebDAV offers more than FTP and thus I think it is superior to what FTP offers. Here you may find few important notes about WebDAV vs FTP.

Keep in mind that once the WebDAV server is configured you don't need anything special on the client side, except the WebDAV location (eg. http//, a user and a password (if you had configured with authentication; normally you do). All you need is your default file explorer (see the examples mentioned earlier).

How to install it?

There are a lot of How-to specific web pages for any operating system. GIYF (you may also read this). I will write here about how I installed it on my GNU/Linux system distributed by Gentoo. Two nice guides you may want to follow are this and this. Anyway, it didn't worked from top to bottom for me, thus this post.

  1. Because I had already the Apache2 installed (and it was compiled with WebDAV support too!) and I didn't wanted to reinstall it, I just start by enabling the WebDAV module in the Apache configuration file. On Linux Gentoo the Apache service configuration file (apache2) is located on /etc/init.d/apache2. On other systems it may be surely on other path and perhaps even under another name (read this). Anyway, just make sure that the APACHE2_OPTS contains (among other things) the DAV and DAV_FS options:


  1. Create the root folder where you want to store your WebDAV share (eg. /home/eugen/dav/)
    1. in the above directory we are going to store those files (lockdb, password-file,etc) that has something to do with our WebDav server; so let's start with the share folder:
      1. Create a subdirectory called share, ie. /home/eugen/dav/share
  2. Make sure that the user that starts the Apache service/daemon owns that folder recursively (in Linux change the folder ownership like chown -R eugen:apache /home/eugen/dav/)
  3. For basic authentication we can use (on Linux) a flat file user-password authentication file. This file is created with the aid of htpasswd2 tool:
    • sudo htpasswd2 -c /home/eugen/dav/.davpasswd my_user_name
    • for the next users DON'T use the -c argument; it means "create the password file" and we don't want to recreate it (aka overwrite it), right?
    • if you want to change the password at a later time then just run this command: sudo htpasswd2 /home/eugen/dav/.davpasswd my_user_name
  4. Because I had enabled the VirtualHost on my Apache (see the -D DEFAULT_VHOST option in APACHE2_OPTS) I had to create the following configuration file in /etc/apache2/vhosts.d/ directory:
    • so, in the Apache's virtual host configuration directory I created a new configuration file called webdav.conf with the following content:
# Virtual Host for http://webdav.local/share #

DavLockDB "/home/eugen/dav/lockdb"
<VirtualHost *:80>
        Servername webdav.local
        DocumentRoot /home/eugen/dav

    # these will help us to troubleshoot WebDAV errors
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    CustomLog /var/log/apache2/webdav_access.log common
    ErrorLog /var/log/apache2/webdav_error.log

    Alias /share /home/eugen/dav/share
    <Location /share>
            Order allow,deny
            Allow from all 
            Options None
            DAV On
               AuthType Basic
               AuthName "webdav"
               AuthUserFile /home/eugen/dav/.davpasswd
               Require valid-user

Note that my web (virtual) server name is webdav.local and the WebDav enabled share is called /share so we are going to access it like <protocol>://webdav.local/share/.

Note also that we using basic authentication (see AuthType Basic) with a generic prompt name "webdav" (see AuthName "webdav") and thus we will be prompted to enter the username/password:

webdav basic authentication

  1. The next logical step was to restart/reload the new Apache configuration, so just run /etc/init.d/apache2 restart (or apache2ctl reload)
  2. To make sure everything is OK just install the litmus - WebDAV server protocol compliance test suite. This tool not only that tests your server compliance with WebDav protocol but if it won't work then you know that something is wrong with your setup. The most common error is 403 forbidden error. I've got this error when:
    1. I haven't had those two lines within Location section (ie. "Order allow,deny" and "Allow from all")
    2. bad ownership/permission of /home/eugen/dav/
      1. make sure that this folder is owned by apache (or www-data) and you are member of the group that you specify on ownership, ie. chown -R my_group:apache /home/eugen/dav/ where you are member of my_group (it could be your Linux user name)
      2. make sure you set +2777 permission on that folder (YES, this is a security issue but right now I don't know how to fix it properly; if you use WebDav for testing purpose and not in production then you may be saved by this trick); I will investigate soon what is the right way of doing and I will update this part of documentation
  3. Assuming that litmus work then any WebDav client you might use will certainly work (except when it's buggy).
    1. in Linux / Xfce Thunar file manager you can connect the WebDav share by typing the following address in location bar: dav://webdav.local/share/ , where the dav is the protocol name, probably the name Thunar file manager implementation chose it
    2. Note that the protocol might be named webdav or something else, depending on what client application (file manager, whatever) are you using

If you still have troubles with your WebDav setup then GIYF.


WebDav works over HTTP and HTTP is part of the WWW implementation, thus WebDav - which allows among others to edit files directly - is that thing that makes possible editing files over WWW. Keep in mind that WWW was not built solely around GET (read document) but also around PUT and DELETE (change document).

The installation is quite trivial for the most sysadmins. Of course, there are a lot of features that are not covered (yet) by this article. I promise to update soon this article.

Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.

The following two tabs change content below.
Editing files over www

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.
Editing files over www

Latest posts by Eugen Mihailescu (see all)

Tagged on: ,

Leave a Reply

Your email address will not be published. Required fields are marked *