PiDav – WebDav Raspberry Pi Tutorial – Part Two

Raspberry Pi WebDav part 2
In part one of the WebDav Raspberry Pi tutorial you were shown how to set up your Pi with Apache.

Apache will act as your web serving part of the PiDav solution. Next up I will show you how to setup WebDav and configure a user so that you can securely connect and save files on you WebDav server.

I used this article as a basis for this post and I’d strongly recommend you have a look at it as there are some other elements you may want to do (especially if you plan to access from Windows).

Right so now we have Apache installed you need to enable the relevant module with the following command:

sudo a2enmod dav_fs

Next up we need to enable the module:

sudo a2enmod auth_digest

So now you need to create a virtual host directory /var/www/web1/web and then make www-data the owner of the directory you create:

sudo mkdir -p /var/www/web1/web
sudo chown www-data /var/www/web1/web

Now edit the default Virtual Host file by running the following command:

sudo nano /etc/apache2/sites-available/default

Now copy the text from this file into your default site.

You will be prompted to create a password for this account. I suggest using your default pi password.

Now we need to change the permissions of the passwd.dav file so that only root and members of the www-data group can access it:

sudo chown root:www-data /var/www/web1/passwd.dav
sudo chmod 640 /var/www/web1/passwd.dav

With that all done reload Apache:

sudo /etc/init.d/apache2 reload

Phew! Now all you need do is pick your favorite WebDav client and connect… Here I’m using the excellent Documents from Readdle on an iPad.
When connecting inside your next you need to type the URL as http://IP-ADDRESS/webdav20130124-181429.jpg

Your username is pi and password is what you just set.


Got all that? If you got stuck or it didn’t work feel free to get in touch and I will help you if I can.

  • Stilman

    Wow that was a lot of work.

    I assume you did not know that BarracudaDrive was ported to the Raspberry Pi and is available via the Pi store.

    BarracudaDrive is much faster and uses a lot less RAM on the Raspberry Pi since BarracudaDrive is designed for resource constrained systems such as the Pi.

    Check out the BarracudaDrive WebDAV NAS tutorial, which continues where you left off.

    • Thanks, I wasn’t aware of the Barracuda Drive port, so will take a look.

  • Hi mate, thx for the tutorial..seems there’s a step or two missing? When copying to the sites-avalable file, are we replacing the default contents or adding a new virtual host below.

    Also, you mentioned that a password prompt will appear – when is that supposed to happen? It doesn’t happen after saving the sites-enabled file in nano.

    I can’t connect properly to webdav because it seems that the user/pass isn’t registered. I can connect to the webserver however and see a blank directory listing at my http://LOCAL_IP_ADDRESS

    Also, are we supposed to copy the password.dav file from somewhere? It wasn’t created, so I’m getting a:
    chown: cannot access `/var/www/web1/passwd.dav’: No such file or directory

    any ideas?

    EDIT- My answers were solved by following the linked tutorial at the top of this post! Be sure to do that!

  • Andreas B

    Could you please tell me/us how to add a second folder/virtualhost?

  • Pingback: MyRaspi List | Creative Geckos()

  • Heinz

    Works like a charm with http. What are the steps to work with https? Apache is running with ssl and for instance wordpress and phpmyadmin are accessible via https.

    • Augusto

      I was just going to comment on this too. But first, thanks Gary for making this tutorial!

      This solution is OK if you’re going to access the data from your own network, but it’s not secure if it’s over the internet as it uses plain HTTP… so anyone can capture your username, password or any files that you upload or download.

      To make it secure it needs to be over HTTPS. I think some of the steps to achieve that are described here:

  • Pingback: 2) My 설치과정 정리 | sungsjang 블로그()

  • Pingback: Experiments In Setting Up a WebDAV Apache File Server Using Raspberry Pi – Hello World!()

  • Pingback: Experimenting With the WebDAV Apache File Server On Raspberry Pi – Hello World! (Or, Learning the tools of the trade!)()