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

Rate It! (Average 0, 0 votes)



7 Responses to WebDAV with Ubuntu

  1. January 30th, 2009 | WebDAV with Ubuntu | Shablogs

    ...es through an easy drag and drop interface, and works across windows, mac and linux. Original post:
    WebDAV with Ubuntu Tags: calendar, ...

  2. January 31st, 2009 | JohnMc

    Hate to say it but as offered this will not work!!

    "sudo ln -s ../mods-available/dav* ." wrong.
    "sudo htpasswd -s -c /etc/apache2/.htpasswd " wrong. I believe you need the -m option to create the file if it does not exist.
    Finally there is a step missing as well. The .htpasswd file must have the group attributed modified. Simply doing a touch on the file does not create the proper owner:group attributes.

    I have gone though this and have noted these steps, made the corrections and it does work.

  3. February 1st, 2009 | nubae

    Ummm... yes it will... I've just set it up on a brand new box, there is nothting wrong with linking all mods available to the current directory to enable them in apache. Secondly... that is to create the first user for htpasswd... after that u'd use the same command with the username u want on the end... the option to create a file is -C for Create.... Please, if you are gonna claim something is wrong publically, check it out first, physically try it out, as I have, many times... U couldnt possibly have tried this, as the -m flag, which u state is for creating a new file is in fact for encrypting with md5... not the M for the -m. It works just fine... now one thing that I haven't done, which was really the purpose of this whole excercise was to incorporate it into Moodle, be it the new 2.0 series or the specially modified 1.9 version.

    Regards,
    Nubae

  4. February 26th, 2009 | Anonymous

    Syntax error on line 5 of /etc/apache2/httpd.conf:
    AuthName not allowed here

  5. May 26th, 2009 | hieronymouse » Blog Archive » links for 2009-05-25

    ...om/howardshippin/webdav">webdav ubuntu) WebDAV with Ubuntu - nubae's Habari
    sudo /etc/init.d/apache2 restart
    (tags: webdav...

  6. June 11th, 2011 | Francis Laughon

    My brother recommended I might like this website. He was entirely right. This post truly made my day. You can not imagine simply how much time I had spent for this info! Thanks!

  7. July 16th, 2011 | program partnerski złote myśli

    I am certainly gladsome that I found ur site, it had just about all of the information I have been searching for. I'm going to retain on viewing this specificweb site more often.

Leave a Reply

(will not be published)