
PLEASE NOTE THIS POST HAS BEEN SUPERCEEDED in 2023. The lastes post can be found here:
In part one of the WebDav Raspberry Pi tutorial you were shown how to set up your Pi with Apache.
https://www.head4space.com/pidav-webdav-raspberry-pi-tutorial-part-one/
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/webdav
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.
13 Responses
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.
http://barracudadrive.com/RaspberryPi.lsp
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!
Thanks for updating your comment.
Could you please tell me/us how to add a second folder/virtualhost?
[…] Server Link –> webdav mit apache web server –> PiDav – WebDav Raspberry Pi Tutorial Link –>webdav mit lighttpd web server –> WebDav mit […]
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.
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: http://www.instructables.com/id/Apache-SSL-WebDav-Server/step2/Install-Ubuntu/.
[…] http://www.head4space.com/pidav-webdav-raspberry-pi-tutorial-part-two/ 이거보고 하면 될 것 같은데.. 너무 어려워.. […]
[…] found a tutorial on using WebDAV here. Since I already had the Apache server installed, I gave it a […]
[…] found a tutorial on using WebDAV here. Since I already had the Apache server installed, I gave it a […]
Help please. 🙂
Think I’ve followed all these instructions but no workie:
$ cadaver http://localhost/webdav/
Could not access /webdav/ (not WebDAV-enabled?):
405 Method Not Allowed
Connection to `localhost’ closed.
dav:!> exit
Newly created Pi3. updated as soon as i brought it uip and followed the instructions.
pi@pi:/var/www $ ls -lrt
total 8
drwxr-xr-x 2 root root 4096 Jan 6 10:26 html
drwxr-xr-x 3 root root 4096 Jan 6 10:32 web1
pi@pi:/var/www $ cd web1
pi@pi:/var/www/web1 $ ls -lrt
total 8
drwxr-xr-x 2 www-data root 4096 Jan 6 10:28 web
-rw-r—– 1 root www-data 108 Jan 6 10:34 passwd.dav
pi@pi:/var/www/web1 $
[…] Tham khảo: [1] http://www.head4space.com/pidav-webdav-raspberry-pi-tutorial-part-two/%5B2%5D […]