WebDAV (Web-based Distributed Authoring and Versioning) is, as Wikipedia says, “a set of methods based on the Hypertext Transfer Protocol (HTTP) that facilitates collaboration between users in editing and managing documents and files stored on World Wide Web servers”. Popularly speaking, it makes it possible to access the files on your webserver as if they were on a local disk of your PC. Much more practical than FTP-ing files back and forth… It uses HTTP as transport protocol, so no need to open extra ports in your firewalls. No extra software needed on your web server if you run Apache: it’s included. You also don’t need any extra software or drivers on your Windows PC: it’s also already included.
Getting it to work was not really difficult, but it involved several steps that I didn’t find mentioned in a single place, so here I will summarize what I did. My configuration is:
- Windows 7 Home Premium, 64 bit (behind ADSL router with NAT)
- Centos 5.5 with direct internet connection + Apache 2.2.3 , configured for several virtual (name based) hosts
The short version for those who only need a few words:
- Enable WebDAV for a directory on the web server, set desired permissions for apache group
- Select “digest” authentication (not “basic”, as Windows doesn’t support that)
- Create password file with “htdigest” (not “htpasswd!)
- On Windows, disable “automatically detect settings” for Internet Explorer (essential for good performance)
- Mount WebDAV folder on Windows
OK, now a bit more details:
My apache config file is located in /etc/httpd/conf/httpd.conf. I modified one of my virtual host sections into:
<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot /var/www/html/yabu
ServerName yabu.example.com
Alias /webdav /var/www/html/yabu
<Location /webdav>
DAV on
AuthType Digest
AuthName "webdav"
AuthDigestDomain /webdav http://yabu.example.com/webdav
AuthUserFile /var/www/html/yabu/passwd.dav
Require valid-user
</Location>
</VirtualHost>
As you can see, I selected the “Digest” authentication method, not the “Basic” method that is used on most web pages I found. The reason is that Windows does not support the “Basic” method. Microsoft has a Knowledge Base article that tells you how to change that, but I didn’t try that myself.
I then created a password file with the following command:
htdigest -c /var/www/html/yabu/passwd.dav webdav yabu
chown root:apache /var/www/html/yabu/passwd.dav
chmod 640 /var/www/html/yabu/passwd.dav
And then restarted Apache by:
service httpd restart
If you wish, you can check the correct operation with the Linux tool “cadaver”. If you don’t have it:
yum install cadaver
Then try to connect:
cadaver http://yabu.example.com/webdav/
On Windows, it’s essential that you disable the “automatically detect settings” for Internet Explorer. If you don’t do that, WebDAV may be very slow. Open Internet Explorer (I use IE 8). Go to Tools, Internet Options, Connections, LAN settings and disable “Automatically detect settings”.
Now you’re ready to mount your WebDAV filder on your PC. Open Windows Explorer, right click on the “Computer” icon and select “Map network drive…”. Select a drive letter and in the “Folder” field, type the URL of you WebDAV folder. For instance:
http://yabu.example.com/webdav/
Enter the username and password as you have configured on your webserver (with the “htdigest” command) and after “OK”, you should see your new network folder…
For other versions of Windows, check out this link