The Cheap Geek
Oct 25 / 12:04pm

WebDAV, Dropbox, and an iPad walk into a bar.

Two weeks ago apple released updates to all three iWork applications, Pages, Numbers, and Keynote on the iPad. The update to version 1.2 adds some small new features such as MS office export capabilities across all the applications, word count in Pages, and the ability to open .csv and .txt files. The biggest new feature included in this update I'd this suability to open and save files from your MobileMe iDisk or any other WebDAV disk. This is a huge feature that enables iWork to be a powerful office application without access to the iPad’s filesystem.

WebDAV is a web protocol that enables file reading and writing via the web. A few cloud storage services support WebDAV including MobileMe but favorites such as Dropbox and Box.net lack WebDAV support. Since I have replaced MobileMe with other services including dropbox I wanted to figure out a way to allow iWork to read and write files from my existing dropbox account. This tutorial is based on OS X but WebDAV can be set up on any windows or Linux machine.

1) Start Apache

You will need to enable Web Sharing, since the WebDAV service will be provided by Apache, the web server on Mac OS X. You do not necessarily need to have a web site running, but you will need to activate and run Apache. Go to System Preferences > Sharing, and turn on the box labeled Web Sharing.

Image

 

2) Enable WebDAV support in Apache

First navigate to the /etc/ folder. This is a hidden folder so I recommend using the Finders go to folder feature as show below.

0image

 

Once there copy the file /etc/apache2/httpd.conf to your desktop and open it with your favorite text editor, then locate this line:

LoadModule dav_module libexec/apache2/mod_dav.so


Remove the “#” at the beginning of the line if one exists.

Then locate this line

Include /private/etc/apache2/extra/httpd-dav.conf


Again, make sure it is not commented out. It is disabled by default, so you need to remove the “#” from this line. Finally, save the file and then drag it back into it’s existing folder. You will be prompted for your admin password.

3) Configure WebDAV

Next, edit the file /etc/apache2/extra/httpd-dav.conf by dragging it to your desktop as before. Add a section in it to create our new WebDAV share. Here’s what the new section should look like. You should also go ahead and delete the /usr/uploads share that is set by default.

Alias /webdav "/Library/WebServer/WebDAV"

Dav On

Order Allow,Deny

Allow from all

AuthType Basic

AuthName WebDAV-Realm

AuthUserFile "/usr/webdav.passwd"

require user YourUserName


On line 1, the name following the Alias keyword is the URL you’d like for your new WebDAV share. I recommend leaving this as is. The second half of this line, the portion in double quotes, should be the path to the portion of your Dropbox you would like to access on the iPad. My line 1 reads as follows.

Alias /webdav "/Users/jordanpatterson/Dropbox/Documents"

 

On line 9, we specify the authentication scheme as Basic, not Digest. The security conscious will note that this sends unencrypted passwords over plain text, so don’t use this username and password combination for anything else.

On line 14, substitute the username you would like to use for your WebDAV account. Remember this because you will need this again in the next step.

4) Create user accounts and passwords

Use the htpasswd tool to create your password file. Enter the following command in terminal.

htpasswd -c /usr/webdav.passwd "YourUserName"

New password:

Re-type new password:

Adding password for user YourUserName


5) Create the necessary directories

Enter the following command in terminal.

sudo mkdir -p /usr/var


6) Setup permissions correctly

Enter the following command in terminal.

sudo chown -R www:www /Library/WebServer/WebDAV2


sudo chown -R www:www /usr/var


sudo chgrp www /usr/webdav.passwd


7) Restart Apache gracefully

Enter the following command in terminal.

sudo apachectl graceful


8) Adjust permissions of Dropbox folder

Get info on the Dropbox folder you are using with WebDAV.

1image

 

In the sharing and permissions portion of the get info window click the lock icon and authenticate with your account password. Then click the plus button and add your user account and give it read and write access.

2image

 

To ensure no issues I went ahead and gave everyone read and write permissions to this folder. Finally, click on the cog wheel and apply these permissions to all enclosed folders.

3image

 

You have now successfully set up a WebDAV server on your Mac.

9) Configuring your iPad

Now on to the iPad settings. Open iWork and click on either the copy to or copy from icon.

Select the webdav option and enter the ip address of your Mac, and the user name and password you set in step 4 above. iWork will now remember this information and you will be able to copy to and from our Dropbox folder within iWork.

If you would like to access your WebDAV server from outside your local network you can forward port 80 to the IP address of the mac running the WebDAV server and enter your external ip address into iWork. As a word of caution, I am sure that forwarding port 80 is a cause for concern by many security experts. If you have any reservation about this please only access the WebDAV server only over your local network as i am not responsible for any issues you may encounter. To continue with the disclaimers, backup your data before setting this up. I had no issues at all but I don’t want any of my readers to loose data.

 

Update: I forgot to add that the skeleton of my WebdADAV setup came from a great article by Manus Tungare.  This is a great piece on setting up WebDAV for Omnifocus syncing.

18 comments

Nov 10, 2010
Gillie said...
Great article and reference well done. However I have just found out that box.net has a webdav service with a 5GB limit for free. I am going to give this a go. Thanks for the info though.
Nov 10, 2010
I tried using their service as well, they have a great iPad app so in theory it should work just like dropbox. However I had a lot of trouble getting it to connect. Please report back and let us know how it worked.
Nov 17, 2010
gggeek said...
Great! Did you test it using svn as webdav provider, so that you reap the benefit of document versioning, too?
Nov 17, 2010
I knew that WebDAv supported version tracking of files but I decided to rely on Dropbox's built in file versioning system.
Dec 02, 2010
Zane Shannon said...
Or, you could just use the new DropDAV service designed specifically for this application. It translates between WebDAV and the Dropbox API for you. Check it out at https://dropdav.com
Dec 02, 2010
Wow Zane, that looks like an awesome service. Is it only a free service with a free Dropbox account?
Dec 02, 2010
Zane said...
Yeah, but it's very reasonably priced and there's an automatic 14-day free trial to make sure it works like you want it too. I've been testing it for a few weeks and it's never let me down so I highly recommend it if you need WebDAV and Dropbox to play nicely.
Dec 10, 2010
DeepVoid said...
Just use DropDAV with your free DropBox account, and magically Numbers, Pages and Keynote will have the right folders feature :-)
Dec 17, 2010
Cece said...
So this only works on a Mac? I have a PC, would I still be able to integrate like this? Thanks.
Dec 17, 2010
There are ways to get this running on a windows box, I will do a little research and get back to you. I would recommend trying out dropdav as well.
Dec 23, 2010
Josh said...
Zane, can you please point me towards the setting in Pages for setting dropDAV as the webdav server? I only see mobileme in the share menu. Thanks!
Mar 28, 2011
Anon said...
Excellent work Jordan. We got ours up and running today also. We decided to go your route first - test the waters with the iPad 2 connecting to one of our office iMac's. From here we'll likely host our own WebDAV server on slicehost.com

We opted against DropDAV because we don't know if we can truly trust the company to have access to our Dropbox account. The data inside is too secure to chance (in this case).

Does anyone know more about DropDAV security practices?

Mar 29, 2011
You bring up a good point, I do not know anything about the security of DropDav other than what is published on their site. Because my data is just personal data I am not that concerned. If I was using dropbox for a business and wanted more security I think running a webdav server is a great idea. I also think Lion will make the process even easier and more affordable since the server tools will be available with the client OS rather than a $1000 up-charge for the server version of OS X.
Apr 07, 2011
Andrew Menzies said...
We have been using Webdav here to transfer files to our server. It all worked well and we were very happy with the solution. However, we have found that the iPad loses its webdav settings if it is turned off or loses power. Has anyone else come across this issue? We are using the iPads in a school, so need the settings to hold.
Jan 06, 2012
Andrew said...
Hey, Jordan. Thanks for posting this valuable information. However, I am having difficulty on step 4. Terminal is saying: htpasswd: cannot create file /usr/webdav.passwd.

Can you please help?

Thanks.
Andrew

Feb 16, 2012
Federico de Andres said...
Love the idea, had a few problems on Lion, but you can go to the App Store and download free app MediaMaster Server, that does the same in just a few clicks.

http://itunes.apple.com/us/app/mediamaster-server/id427559105?mt=12

Feb 16, 2012
Andrew Brainerd said...
Federico, thanks for posting. What did you put in as your server address in the webdav setup. I tried my local IP and it isn't working.

Please advise.

Thanks.

Feb 17, 2012
Sorry you have to add the port number at the end of your IP.

http://192.168.X.X:8000

hope that helps Andrew.

Leave a comment...