8 Comments

Summary:

With the latest release of iWork on iPad, sharing across your local Wi-Fi network is now possible. Using WebDAV, files can be shared between iWork on your Mac and iWork on your iPad. All you need to do is enable WebDAV on your Mac. But how?

webdav_feature

With the latest release of iWork on iPad, sharing files across your local Wi-Fi network is now possible. Using WebDAV, files can be shared between iWork on your Mac and iWork on your iPad. All you need to do is enable WebDAV on your Mac. But how do you do that?

What is WebDAV?

WebDAV stand for “Web-based Distributed Authoring and Versioning protocol”, and it works over HTTP. WebDAV was designed for read/write access on web servers, which is great, because every Mac ships with a web server built-in. When you enable “Web Sharing” in your System Preferences, you’re actually running an Apache web server. The problem is that while the necessary modules that support WebDAV have been installed, WebDAV isn’t configured by default on OS X, and you need more than just administrator privileges to enable it.

More Than Administrator Privileges

If you’re extremely concerned with security, you’re logging into your Mac every day using an account that doesn’t have administrator privileges. Unlike its distant cousin from Redmond, OS X can execute just fine without Administrator account access. There are times, though, when administrator privileges are required, such as installing software, or changing some System Preferences. Then there are the rare cases, like this one, where you need to change configuration files that weren’t meant to be changed. That’s when you need what’s called “root” access.

“SUperuser DO” or sudo for short, is the command that grants Administrator accounts root-level access to a Mac. It is meant to be used for short periods of time and requires the Administrator password with each execution. When using the terminal to execute commands, preceding each command with sudo will enable that command to be executed with root-level privileges. Given the fact that we’ll be altering server configuration files in hidden folders on the system, we’ll need root access in order to enable WebDAV.

Does this expose your Mac to additional security risks? Yes it does. From a strictly security perspective, nothing being discussed from this point forward is a “good” thing. On the other hand, from the strictest security perspective, simply turning on your Mac is a security risk in and of itself.

Enabling WebDAV on OS X 10.6.4 Snow Leopard

Step 1: Shutdown the Web Server

Make sure you’re logged in to a user account that has administration privileges, open System Preferences, and ensure that Web Sharing is turned off.

Turn Off Web Sharing

Step 2: Edit the Apache Web Server Config Files

So much for the easy part. From here on out, everything will be done via the terminal utility. In the Applications folder, there’s a sub-folder called Utilities, in which is the Terminal application. We’ll be using that for most of the remainder of this tutorial.

  • Open the Terminal and change directories to the location where the first config file is located.
    cd /etc/apache2
    
  • Use the sudo command to open and edit the httpd.conf file located in /etc/apache2 folder (use your favorite plain text editor like Emacs or vi, or optionally execute the following command to open the file in TextEdit). NOTE: You will be prompted to enter the password of the account you are logged in with.
    sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/apache2/httpd.conf
    
  • Search for and un-comment the following line”Include /private/etc/apache2/extra/httpd-dav.conf”. NOTE: To un-comment the line, simply remove the ‘#’ at the beginning of the line.
  • Save the changes to httpd.conf and quit the editor.

Step 3: Edit the WebDAV Module Config Files

Now that the WebDAV module is turned on, the next time the Apache Web Server starts up, it will look for instructions on how to execute the WebDAV module. This next series of configurations will tell WebDAV exactly which folder should be shared.

While it’s tempting to share a folder you’re already using, it’s not recommended with the following configuration. Files located in this particular folder will be “owned” by the web server, and a separate security authority will govern access to the files. Attempts to read and write to files in this folder using the following security configuration could render the files inaccessible to the web server, and therefore to the iPad, too.

  • Open the Terminal and change directories to the location where the second config file is located.
    cd /etc/apache2/extra
    
  • Use the sudo command to open and edit the httpd-dav.conf file located in /etc/apache2/extra folder (use your favorite plain text editor like Emacs or vi, or optionally execute the following command to open the file in TextEdit).  NOTE: You will be prompted to enter the password of the account you are logged in with.
    sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/apache2/extra/httpd-dav.conf
    
  • Delete the existing Alias and Directory configurations and replace them with the following:
    Alias /webdav "/Library/WebServer/WebDAV"
    WebServer/WebDAV">
      Dav On
      Order Allow,Deny
      Allow from all
      AuthType Basic
      AuthName WebDAV-Realm
      AuthUserFile "/usr/webdav.passwd"
      <LimitExcept GET OPTIONS>
        require user myipad
      </LimitExcept>
    </Directory>
    
  • Save the changes to httpd-dav.conf and quit the editor.

Step 4: Create New WebDAV Users

The configuration in Step 3 established a password file, /usr/webdav.passwd where the WebDAV module will validate logon attempts for each WebDAV user. One user was also specified in the configuration with the user name of ‘myipad’.

  • Open the Terminal and change directories to the following location:
    cd /etc/apache2/extra
    
  • Create a new WebDAV User Account named ‘myipad’ by executing the following command. NOTE: You may be prompted for the sudo password, and you will be prompted to set the password for the new WebDAV user ‘myipad’ being created.
    sudo htpasswd -c /usr/webdav.passwd myipad
    

Step 5: Create Directories and Setup File Permissions

The configuration in Step 3 also established the location where the files will be hosted. In this case the location is /Library/WebServer/WebDAV. The directory for this new location will need to be created and the appropriate file permissions will need to be established.

  • Open the Terminal and change directories to the following location:
    cd /etc/apache2/extra
    
  • Create the following WebDAV directories as follows:
    sudo mkdir -p /Library/WebServer/WebDAV
    sudo mkdir -p /usr/var
    
  • Finally set the appropriate permissions on the files and directories you just created as follows:
    sudo chown -R www:www /Library/WebServer/WebDAV
    sudo chown -R www:www /usr/var
    sudo chgrp www /usr/webdav.passwd
    

Once all of the above instructions are carried out successfully, you can once again start Web Sharing in System Preferences. This will now turn on Apache with the WebDAV extensions installed and configured.

Access WebDAV from iWork Apps on the iPad

All that is required is to access the new WebDAV share via the iPad. Open one of the iWorks apps, like Pages, and scroll through the docs stored on the iPad. To save a document from Pages to the WebDAV share, select the document and click on the Copy To icon. If you haven’t accessed this WebDAV server before, you’ll be prompted to enter the WebDAV configuration. The Server Address is your local IP address, which can be found in System Preferences under Network by clicking on your active Internet connection in the source menu, followed by “/webdav/”.

Configure WebDAV on iPad

To open a document stored on the WebDAV share, click on the “Open From” icon in Pages. If you haven’t accessed this WebDAV server before, you will be prompted to enter the WebDAV configuration URL, Name and Password.

Access WebDAV from the Finder on the Mac

Unfortunately, I don’t recommend you try to access the directory that is being shared via WebDAV directly. If you do, you may alter the file permissions and render the files inaccessible via WebDAV. Fortunately, OS X does support mounting WebDAV servers directly in the Finder. Launch the Finder, and choose the Go menu. From there select Connect to Server… and enter the URL of the WebDAV server.

Connect To Server From Mac

You will then be prompted with the User ID and Password that was set up on the Mac running WebDAV.

Enter Name and Password on Mac

Access WebDAV from Apps Running on Other iOS Devices

Believe it or not, there are several iOS apps for iOS devices that can access WebDAV shares. Air Sharing Pro ($6.99), JotNot Scanner Pro ($0.99), and WebDAV Navigator (Free) are three examples I’ve used to access the WebDAV share created above. The configuration is again the same; just enter the URL, Name and Password when setting up the WebDAV share in each app and you’re good to go. Happy your WebDAV sharing!

  1. such a great informative article .thanks dear

    Share
  2. Mark Hernandez Saturday, October 2, 2010

    Yes! Thank you.

    Share
  3. Why not use a free WebDAV provider instead? We use cloudsafe.com for our office documents – 1GB is enough for us.

    Share
    1. That certainly is an option. What is outlined above allows for access to a WebDAV share on a personally owned device with potentially more economical storage available. You can also gain access to files you may not want to host via a cloud based service. And if you are on a protected network where access to such external WebDAV providers is blocked, this my be your only option.

      Share
  4. Small part missing in section 3:
    It should read:

    > Delete the existing Alias and Directory configurations and replace them with the following:

    Alias /webdav “/Library/WebServer/WebDAV”

    Dav On
    Order Allow,Deny
    Allow from all
    AuthType Basic
    AuthName WebDAV-Realm
    AuthUserFile “/usr/webdav.passwd”

    require user myipad

    Share
    1. GT & LT signs are breaking the post….

      2nd line is missing the directory cmd and the start of the library name

      Share
  5. We’re using CloudDav from SMEStorage to edit our Google Docs and Amazon S3 files directly through iWork and Pages. It works a treat. It also works with DropBox and other clouds.

    Share
  6. Panos Karyotis Sunday, February 27, 2011

    What a great idea, but it doesn’t work for me. I followed all the instruction with no success.
    This is my first time using terminal and it is not so easy as it seems to be.
    Please, in step 3, when the text editor opens i get i page with a lot of thing on it. What should i do, delete everything and paste your commands, or erase a small part of it? if this is the case which part i should leave there? For an ignorant like me this is a very big deal!!

    In step 5 do i give those lines one by one in terminal or i copy-paste both of them, then i press enter and i’m o.k.?
    And what about the other 3, again one by one or all tighter?

    Sorry to bother you but if any one could enlighten me it would be great!
    Thanks again

    Share

Comments have been disabled for this post