December 9th, 2008 | nubae
WebDAV with Ubuntu
WebDAV is software to allow collaboration between users to manage files through an easy drag and drop interface, and works across windows, mac and linux. It is intended for web servers, and includes rudimentary version control and file locking for groups. This is how to get it working with the Apache webserver on ubuntu linux.
First make sure apache, php and its modules are installed:
sudo apt-get update sudo apt-get install apache2 php5 libapache2-mod-php5 cd /etc/apache2/mods-enabled sudo ln -s ../mods-available/dav* .
Next we need to set up a DAVLockDB file for file locking when multiple users are sharing the folders. This is a very important step, as you'll wind up with Internal Server Errors if you try to use WebDAV without it.
sudo mkdir /usr/share/apache2/var sudo touch /usr/share/apache2/var/DAVLock sudo chown -R www-data.www-data /usr/share/apache2/var
Next we need to setup some form of authentication for the users. WebDAV can be a security risk for this reason, so its important to use something strong. In this case, SHA passwords using .htpasswd should suffice:
sudo htpasswd -s -c /etc/apache2/.htpasswd
Other usernames can be added afterward by using the same command but without the -c flag (create file) as a file is already there. Next we create the webdav directory, which can be called anything, in this case we'll call it shared:
sudo mkdir /var/www/shared sudo chown www-data.www-data /var/www/shared
The final step is adding the directives to Apache so it knows what to do with the shared WebDAV folder. Edit the file httpd.conf:
sudo nano /etc/apache2/httpd.conf
and paste the following into it:
## Location of the DavLock file
DavLockDB /usr/share/apache2/var/DavLock
## Set up the shared directory to use WebDAV and authentication
Dav On
AuthName "WebDAV shared Login"
AuthType Basic
AuthUserFile /etc/apache2/.htpasswd
## Limit access for enhanced security
\
require valid-user
Order allow,deny
Allow from all
Now restart apache and you will have webdav enabled by doing:
sudo /etc/init.d/apache2 restart
You can download a webdav client for firefox here: http://webfolder.mozdev.org/installation.html


