-
Setting up WebDAV on OS X
I was interested in setting up a WebDAV server on my Mac so that I could send files to and from it on my iPad with GoodReader. I found an article about setting up WebDAV on OS X, which was almost correct. Here’s my updates with the proper process and correct configuration.
Before you start, note that any changes made to the Apache configuration files require a restart of the Apache server. This can be done by either checking and unchecking the Web Sharing checkbox under Sharing in System Preferences, or running the following command:
1
sudo apachectl gracefulThese instructions help you to set up a WebDAV server on your machine which exposes the directory /Library/WebServer/WebDAV as your document root. If you want to set up a different directory, then change that path accordingly in all the remaining instructions. Note that the Apache user seems to need to own the path that you expose over WebDAV, so keep that in mind as you are setting things up.
1) Start Apache via System Preferences
Open System Preferences => Sharing and click the checkbox for Web Sharing.2) Modify /etc/apache2/extra/httpd-dav.conf
Open this file and remove any existing WebDAV entries. Modify accordingly to end up with something like this. You should only have one DavLockDB entry anywhere in the file; in my case, one was already there so I left it alone.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
... DavLockDB "/usr/var/DavLock" # Locks down all directory access by default. You can then override # this with additional <Directory/> entries <Directory /> Order Deny,Allow Deny from all </Directory> # Exposes the contents of /Library/WebServer/WebDAV on the # URL http://hostname/webdav/ Alias /webdav "/Library/WebServer/WebDAV" # Sets up WebDAV with access controls. Uses digest auth so you # don't need SSL for your credentials (although note that none # of your file transfers will be encrypted, so don't pull anything # sensitive over the wire without SSL). Specifies a file with # usernames/passwords, and dictates the realm applicable # to this configuration <Directory "/Library/WebServer/WebDAV"> Dav On Order Deny,Allow Allow from all AuthType Digest AuthName WebDAV-Realm AuthUserFile "/usr/var/webdav.passwd" Require valid-user </Directory> ...
If you want to get fancy, there is some additional information on these directives for mod_auth_digest and mod_dav at the Apache web site.
3) Open /etc/apache2/httpd.conf and make sure these lines are uncommented
This enables the appropriate Apache modules that will make use of the configuration you just created.1 2 3 4 5
LoadModule dav_module libexec/apache2/mod_dav.so ... LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so ... Include /private/etc/apache2/extra/httpd-dav.conf
4) Create directories with appropriate permissions
1 2 3 4
sudo mkdir -p /usr/var sudo mkdir -p /Library/WebServer/WebDAV sudo chown -R www:www /Library/WebServer/WebDAV sudo chown -R www:www /usr/var
5) Create the password file and set appropriate permissions
1 2 3 4 5 6
maxbookpro:usr mporges$ sudo htdigest -c /usr/var/webdav.passwd WebDAV-Realm "mporges" Adding password for mporges in realm WebDAV-Realm. New password: Re-type new password: maxbookpro:usr mporges$ sudo chgrp www /usr/var/webdav.passwd
6) Restart Apache
1
sudo apachectl graceful7) Test
As the original article suggests, the easiest way to test is to mount your WebDAV server via Finder.To do this, open Finder and select Go > Connect to Server (⌘K). Type your WebDAV URL, or http://localhost/webdav/ if you are on the server locally. Note that the trailing slash (“/”) is important, and you will not be able to connect without it.
You will be prompted by Finder to type in your username and password, and you need to be careful to enter these exactly as specified for the htdigest command.
Upon success, you will have mounted your WebDAV folder within Finder, and you should be able to copy a file to the folder.
I found that the trailing slash was not required when mounting the WebDAV drive in Snow Leopard, but it doesn’t hurt. You’ll be able to both read and write files to the WebDAV share.
Troubleshooting
If you have any issues, check Console for logs from Apache. It will yell at you if your config is bad.Category: Uncategorized | Tags:
3 Responses to “Setting up WebDAV on OS X”
The trackbacks and pingpacks:
- My Notes » Fixing up apache - Pingback on 10/07/17 22:36
- [apache] WebDav katalog na OSX 10.6 - Pingback on 11/01/14 08:45
- Use Shared Network Folders With The iPad | Macademia - Pingback on 11/04/06 10:01
Related Posts
Recent Posts
- Speak and Spell Samples (2)
- Eulogizing the Insanely Late Steve Jobs (1)
- How to find old Airport Express/Extreme/Time Capsule firmware
- async-http-client
- Using curl with a web site secured by Rails Authenticity Token (4)
- An AppleScript to Toggle Sleep Modes
- Jamming on the Arduinome with mlrv (3)
- SammichSID Finished (1)
- Greater Orlando Hackerspace (3)
- My Arduinome Build in Pictures