Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use WebDAV to share files with all platforms UNIX
WebDAV stands for "Web-based Distributed Authoring and Versioning." It enables you to edit and manage files on a Web server remotely and in collaboration with others. You can read more about it at http://www.webdav.org. MacOS X supports WebDAV as a flavor of shared volume that you can mount through the Finder's Go -> Connect To menu command. Microsoft Windows also supports it as web folders. If you're using Windows XP, open My Computer, then choose Map Network Drive from the Tools menu.

We will use mod_dav with mod_encoding on apache to enable it on your mac OS X client.
Now it's time to open your Terminal.

[Editor's note: I have not tested this hint myself, and if it fails, it's possible you'll wind up with a non-functional Apache, so proceed at your own discretion. We ran a hint on setting up WebDAV a while back, but this one is much more thorough...]

1) Install mod_dav (http://www.webdav.org/mod_dav/)
Type the following in the Terminal:
 % curl -O http://www.webdav.org/mod_dav/mod_dav-1.0.3-1.3.6.tar.gz
% tar xvzf mod_dav-1.0.3-1.3.6.tar.gz
% pushd mod_dav-1.0.3-1.3.6/
% ./configure --with-apxs=/usr/sbin/apxs
% make
% sudo make install
% popd
2) Install libconv (http://www.gnu.org/software/libiconv)
Type the following into the Terminal:
 % curl -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.8.tar.gz
% tar xvzf libiconv-1.8.tar.gz
% pushd libiconv-1.8/
% ./configure --mandir=/usr/local/share/man
% make
% sudo make install
% popd
3) Install mod_encoding (http://webdav.todo.gr.jp/download/)
This module improves non-ascii filename interoperability of apache (and mod_dav) and fix Windows XP authorization. See INSTALL for more details. Type the following in the Terminal:
 % curl -0 http://webdav.todo.gr.jp/download/mod_encoding-20020611a.tar.gz
% tar xvzf mod_encoding-20020611a.tar.gz
% pushd mod_encoding-20020611a/
% ./configure --with-apxs=/usr/sbin/apxs
% make
% sudo make install
% popd
4) Enable WebDAV in the Apache Config File
Modify your httpd.conf in /private/etc/httpd/. I use vi to do it:
 % sudo vi /private/etc/httpd/httpd.conf
Add or uncomment in the beginning of httpd.conf (where you see LoadModules directives):
LoadModule headers_module  libexec/mod_headers.so
LoadModule encoding_module libexec/mod_encoding.so

AddModule mod_headers.c
AddModule mod_encoding.c
Zoom down to the end of the file and add this text:
#
# Set DAVLockDB for webdav support
#

DAVLockDB /private/var/run/davlocks/DAVLockDB
#
#
Fix header for webdav#

BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "Microsoft-WebDAV-MiniRedir/5.1.2600" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS" redirect-carefully

<IfModule mod_headers.c>
Header add MS-Author-Via "DAV"
</IfModule>

<IfModule mod_encoding.c>
EncodingEngine on
NormalizeUsername on
</IfModule>
Save httpd.conf and exit.

5) Configure Webdav folder
Create Dav folder in Default root:
 % sudo mkdir /Library/WebServer/Documents/dav
% sudo chmod -R 775 /Library/WebServer/Documents/dav
Open httpd.conf again and zoom down to the end of the file and add this text:
Alias /dav /Library/WebServer/Documentsd/av
<Location /dav>
DAV On
AuthType Basic
AuthName "WebDAV Restricted"
AuthUserFile /private/etc/httpd/passwords/webdav.access
require valid-user
Order allow,deny
Allow from all
</Location>
Save httpd.conf and exit.

6) Create a user password
If it doesn't exist, create password dir in /private/etc/httpd:
 % sudo mkdir /private/etc/httpd/passwords
Then create a user named davuser1:
 % sudo htpasswd -c /private/etc/httpd/passwords/webdav.access
Provide a password when prompted.

7) Restart apache:
 % sudo apachectl graceful
And that's all, now you have webdav enabled. Open your webdav folder with this url: http://your_ip_number/dav

Useful links:
WevDAV install document
MacDevCenter article
    •    
  • Currently 1.50 / 5
  You rated: 1 / 5 (4 votes cast)
 
[68,340 views]  

Use WebDAV to share files with all platforms | 38 comments | Create New Account
Click here to return to the 'Use WebDAV to share files with all platforms' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
addon
Authored by: benoitc on Nov 14, '02 12:41:06PM

Just forget one shell command before relaunch apache, do :


sudo chgrp -R www /Library/WebServer/Documents/dav

And the alias configuration in httpd.conf is Alias /dav /Library/WebServer/Documents/dav and no Alias /dav /Library/WebServer/Documentsd/av

Sorry, for this errors. Just note that I ran this configuration on my own machine :)





[ Reply to This | # ]
Can not restart Apache
Authored by: Indiecn on Nov 27, '02 02:23:29AM

Help...I went theu everything OK, right until % sudo apachectl graceful
I'm getting this error msg:

/usr/sbin/apachectl graceful: httpd not running, trying to start
Processing config directory: /private/etc/httpd/users
Syntax error on line 1065 of /etc/httpd/httpd.conf:
Alias takes two arguments, a fakename and a realname
/usr/sbin/apachectl graceful: httpd could not be started

Tried :
Alias /dav /Library/WebServer/Documents/dav and Alias /dav "/Library/WebServer/Documents/dav"
But it make no difference...Anybody can help me?



[ Reply to This | # ]
Can not restart Apache
Authored by: benoitc on Nov 29, '02 08:53:31AM

do you have make dave directory before restart apache ?



[ Reply to This | # ]
Can not restart Apache
Authored by: Indiecn on Dec 02, '02 12:14:59AM

benoitc,
Thanks for responding. I did make the directory ( % sudo mkdir /Library/WebServer/Documents/dav).

The problem seems to be the syntax of the Alias, and I did make sure that I typed in everything correctly. Aldo made sure that the privilges of the folder is correct, but still no go.



[ Reply to This | # ]
Can not restart Apache
Authored by: benoitc on Dec 04, '02 06:46:27AM

Alias line is Alias /dav /Library/WebServer/Documents/dav.

When you make dav directory do a chown -R www Library/WebServer/Documents/dav and then chmod -R 775 Library/WebServer/Documents/dav . And it will work in theory.



[ Reply to This | # ]
Alias syntax error?
Authored by: skydivertak on Dec 30, '02 12:09:39AM

I get the same problem. What is the solution??



[ Reply to This | # ]
Alias syntax error?
Authored by: skydivertak on Dec 30, '02 12:58:40PM

Well, I seem to have answered my own question, but I'm not sure what it affects. I simply removed the Alias command, and explicitly changed the next line to include the complete physical path. No errors at all.



[ Reply to This | # ]
Error
Authored by: Crackle on Dec 08, '02 11:16:41PM

apachectl graceful restart
/usr/sbin/apachectl graceful: httpd not running, trying to start
Syntax error on line 241 of /etc/httpd/httpd.conf:
Cannot load /usr/libexec/mod_headers.so into server: (reason unknown)

mmm... is this a typo?

All other Webdav docks include DAVLockDB, why does this version not need it?



[ Reply to This | # ]
Error
Authored by: discordantus on Mar 13, '03 02:44:41PM

I had the same thing happen to me... It seems that (in my case) the module didn't actually get installed. so I just went back to the mod_encoding folder and typed 'make install' again... and apache worked.



[ Reply to This | # ]
works great
Authored by: phatteque on Nov 14, '02 02:51:26PM

This a great tip very easy to follow and works great! webDAV is a wonderful thing!
Thanks for the great tip!



[ Reply to This | # ]
Questons
Authored by: jkubie on Nov 14, '02 05:12:29PM

Great stuff. A few questions:

1) how do you set up separate accounts with separate permissions?
2) are passwords sent securely?
3) are there any differences for OS 10.2 server?
4) is there any documentation for webdav on OS 10.2 server?
5) are mounting instructions for pcs and macs the same as the instructions apple gives to mount idisk?



[ Reply to This | # ]
WebDAV for all accounts
Authored by: flowney on Nov 14, '02 08:20:52PM

MacOS X automatically creates a web site with FTP access for every account created on a MacOS X machine. What I would like to do is extend this to WebDAV for all accounts as they are created.

Can this be done? If so, how?



[ Reply to This | # ]
A couple more typos
Authored by: masskinner on Nov 14, '02 09:01:39PM
% curl -0 http://webdav.todo.gr.jp/download/mod_encoding-20020611a.tar.gz

should be:

% curl -O http://webdav.todo.gr.jp/download/mod_encoding-20020611a.tar.gz

(Note the parameter is a letter, not a number)

LoadModule headers_module libexec/mod_headers.so
LoadModule encoding_module libexec/mod_encoding.so


should be:

LoadModule headers_module libexec/httpd/mod_headers.so
LoadModule encoding_module libexec/httpd/mod_encoding.so


Finally, if you're cutting and pasting, make sure that your editor does not arbitrarily break up the lines where it's not suppose to. For example:

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully

Make sure this is all one line.



[ Reply to This | # ]
A couple more typos
Authored by: Delivery_Guy on Feb 24, '03 02:06:29AM
    Found another one here

Fix header for webdav#

Should be:
#Fix header for webdav
    This was causing me to have a SYNTAX error when I tried to restart apache.


[ Reply to This | # ]
wbdav
Authored by: Tomhoh on Nov 16, '02 03:48:47PM

works great!!!!
just one note. If anyone is using fink remember that fink installes another apache in its /
sw file. restarting apache may require pointing to the default location in os x.

For example
% sudo /usr/sbin/apachectl restart

Thanks again
tom



[ Reply to This | # ]
configure: error: no acceptable cc found in $PATH
Authored by: ptoly on Nov 18, '02 06:33:15PM

I'm afraid I'm getting this error when I try to configure. Anyone have any ideas? I'm still learning command line and only have a vague sense of the $PATH.



[ Reply to This | # ]
configure: error: no acceptable cc found in $PATH
Authored by: mithras on Nov 19, '02 09:22:55AM

install the developer tools



[ Reply to This | # ]
configure: error: no acceptable cc found in $PATH
Authored by: paule on Nov 20, '02 06:08:01PM

That means that you have no compiler installed, like me when I tried this (also not familiar with command line, but learning). When you install developer tools your problem is solved. Then you are ready for the next problem. Mine is that there is no 'LoadModule encoding_module libexec/mod_encoding.so' in the httpd.conf
I also wonder.. I allready had the mod_dav module which came with OS10.2 Is it ne cessary to reinstall from http://www.webdav.org/mod_dav/mod_dav-1.0.3-1.3.6.tar.gz?



[ Reply to This | # ]
configure: error: no acceptable cc found in $PATH
Authored by: benoitc on Dec 04, '02 06:43:12AM

it's better, since I don't know witch version of webdav is installed.



[ Reply to This | # ]
Why use WebDAV?
Authored by: mingking on Dec 09, '02 05:48:08AM

Pardon my ignorance, but why exactly would I want to use WebDAV instead of FTP? I read the FAQ at the WebDAV site and it mentions a few things that I guess I would consider - esoteric. Is there any 'killer' application of it that I'm missing?



[ Reply to This | # ]
Why use WebDAV?
Authored by: mingking on Dec 13, '02 12:29:30AM

Answering my own question after more investigation:

It seems that WebDAV is more like file sharing then just a file transfer protocol like FTP. I.e. it is more like an AFP/SMB/NFS network file system where you can 'mount' a remote file system and the files/folders appear to all of your applications like a local file system. I guess in some senses it is like an open standards version of those proprietary protocols, plus more.

A file sharing model allows for direct editing of the remote content instead of an upload/download model. (Well, at least some portion of the data has to move up and down the wire in order to edit it, but it is transparent to the user and doesn't require a series of steps and helper applications). This enables a locking model so that when one person is editing a file, others are locked out from modifying it, again much like what would happen in a local or networked file system. That would be very important in a collaborative development effort - e.g. if more than one person was simultaneously maintaining the content of a web site.

If I read the docs correctly there are other advantages like you can tell the WebDAV server to copy a file/folder from one location to another on the server - as opposed to copying the data up to your local machine and then copying it back down (which I believe would happen if you use AFP/SMB/NFS).

There also seems to be some high level support for things like server side searching and querying of meta-data about the files on the WebDAV server, like getting the mime-type of a remote file etc.

If my interpretation of the readings are correct I can see how those things would be a nice set of advantages over FTP, and with the extra server side features, an advantage even over a simple network file system. Most of what I do is from Mac to Mac so I generally use AFP if I want to mount remote file systems. But WebDAV looks like it will be more efficient network wise for many things since there is more that is done on the server side. There are likely other advantages, but I don't fully understand WebDAV enough at this point to extrapolate any more.

Overall, it looks like WebDAV is 'a good thing'. It looks like I'll spend the effort to get it installed and give it a whirl.



[ Reply to This | # ]
Well...
Authored by: julik on Feb 03, '03 06:54:53AM

First it is much more firewall-tolerant - you will be able to transfer files even if you are behind a firewall, because DAV uses HTTP port by default and defaults itself to only one port instead of 2 (as FTP does).
Second - DAV connections are much more integrated into customer-type OS (mind there is no FTP folders by default in Windows and FTP mounting in OS X works in read-only mode, so you can downlaod but cannot upload, delete...). Third, DAV file transfers (especially small) are to my experience faster than FTP.
Third, DAV supports locks/check-ins and check-outs (which are useful in multiuser workflow, for project authoring where many files are used). Many today's content management systems are built around DAV.



[ Reply to This | # ]
Another Problem
Authored by: specbebop on Dec 12, '02 08:19:42PM

I've run through all of the instructions, making corrections as noted in the replies and I have two problems.

First, in my httpd.conf file there's no reference to 'LoadModule encoding_module libexec/mod_encoding.so' or 'AddModule mod_encoding.c'

Second, at the end when I restart apache I get this error:

% sudo apachectl graceful
/usr/sbin/apachectl: line 171: 5087 Trace/BPT trap $HTTPD -t >/dev/null 2>&1
/usr/sbin/apachectl graceful: configuration broken, ignoring restart
/usr/sbin/apachectl graceful: (run 'apachectl configtest' for details)

so i ran configtest and got this:

% apachectl configtest
Processing config directory: /private/etc/httpd/users
Processing config file: /private/etc/httpd/users/user1.conf
Processing config file: /private/etc/httpd/users/user2.conf
Syntax OK
dyld: /usr/sbin/httpd Undefined symbols:
_XML_ErrorString
_XML_GetErrorCode
_XML_Parse
_XML_ParserCreate
_XML_ParserFree
_XML_SetCharacterDataHandler
_XML_SetElementHandler
_XML_SetUserData
/usr/sbin/apachectl: line 171: 5092 Trace/BPT trap $HTTPD -t

does anyone have any idea what i might have done wrong. If I revert back to my old httpd.conf file, apache restarts just fine.



[ Reply to This | # ]
Another Problem
Authored by: specbebop on Dec 13, '02 01:51:34PM

Ok I figure out all the errors i'm getting after trying to restart Apache. It's due to Marc Lyaniage's PHP module I have installed. I simply set the dav module to load after the PHP module and it works fine.

still don't have the encoding module showing up in my httpd.conf file. don't know what that's about.



[ Reply to This | # ]
Another Problem
Authored by: benoitc on Dec 31, '02 08:21:50PM

It allow users of windows xp to mount a protected dav folder.



[ Reply to This | # ]
Another Problem (fixed)
Authored by: mpursley on Jun 05, '03 01:41:58AM

Woah, good thinking... you fixed mine too... ; )

M@



[ Reply to This | # ]
Another Problem
Authored by: benoitc on Dec 31, '02 08:23:49PM

You have a problem in your httpd.conf



[ Reply to This | # ]
Make error with mod_encoding (OSX 10.2.3)?
Authored by: skydivertak on Dec 30, '02 01:03:06PM

I get the following error when trying to do the "make" in step 3), any ideas???


[Orgasmatron:~/documents/attachments/mod_encoding-20020611a] skydiver% make
/usr/sbin/apxs -c -liconv mod_encoding.c
gcc -DDARWIN -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -g -Os -pipe -DHARD_SERVER_LIMIT=2048 -DEAPI -DSHARED_MODULE -I/usr/include/httpd -c mod_encoding.c
mod_encoding.c: In function `iconv_string':
mod_encoding.c:100: warning: passing arg 2 of `libiconv' from incompatible pointer type
cc -bundle -undefined suppress -flat_namespace -Wl,-bind_at_load -o mod_encoding.so mod_encoding.o -liconv



[ Reply to This | # ]
Make error with mod_encoding (OSX 10.2.3)?
Authored by: digitalone on Mar 07, '03 01:06:37AM

I got the same error, and Apache said the conf files is broken on restart. I remarked it out and now I get an error at:
Fix header for webdav#
Fix being illegal or not a command. I remark it out and apache still works, but no webdav.

I have tried ro remake it and redownload, thinking I got some bad bits.

Please help, I need to get this working.



[ Reply to This | # ]
Connection -36 error when trying to access Dav
Authored by: skydivertak on Dec 30, '02 02:05:23PM

I have everything up-and-running as shown, but I get a connect to sever error "An error has occured (error = -36)" when I try to connect to my machine from Finder. This appears to be some generic I/O error, if this is a MacOS error return.

I don't even get prompted for userid/password first.

Any ideas???

Tak



[ Reply to This | # ]
Connection -36 error when trying to access Dav
Authored by: below on Feb 25, '03 05:24:40AM

No idea... but when you find out what is wrong, please let me know.
I installed webDAV on my debian box, and I can access it with a webbrowser, or with iCal, but not mount it as a fileserver.

Thanks,

Alex



[ Reply to This | # ]
Connection -36 error when trying to access Dav
Authored by: discordantus on Mar 13, '03 02:49:47PM

I get that error too, and it seems that it's because apache has crashed... at least, it's no longer running after that.



[ Reply to This | # ]
Connection -36 error when trying to access Dav
Authored by: djdown on Aug 04, '03 08:19:33PM

I had this problem and eventually realized it was a conflict between PHP and mod_dav. The LoadModule line for mod_dav needs to occur after the LoadModule line for PHP in the file. The ordering is important because it defines the content processing pipeline used by Apache. In this case, PHP can hijack the connection and not allow mod_dav to work. Putting the mod_dav LoadModule after the PHP LoadModule in the httpd.conf fixes it.



[ Reply to This | # ]
apache chokes on "Fix..."
Authored by: avramd on Mar 14, '03 06:03:49PM

Hello,

I'm following these instructions, but after building and installing everything, apache chokes on the

Fix header for webdav#

directive. Is this a real directive? Or is it supposed to be a comment?

If it's real, which module or lib is supposed to provide it? I don't get any errors indicating that any of my modules are not loading.



[ Reply to This | # ]
never mind...
Authored by: avramd on Mar 14, '03 06:18:42PM

sorry all, I didn't see that reply above w/ the extra syntax error fix



[ Reply to This | # ]
Use WebDAV to share files with all platforms
Authored by: germsteel on Feb 05, '04 04:06:39AM
Here's the OS X WebDAV problem. I only see 1024.8 MB available in my shared directory when there should be 60GB. Thanks to William Carrel on the devdav mailing list for the explanation

http://mailman.lyra.org/pipermail/dav-dev/2004-February/005307.html
There's a patch for mod_dav at:

http://www.carrel.org/sw/dav-quota-diskfree
Unfortunately my Apache host is an NT 4.0 SP6 machine. It would be great if someone could supply a patched mod_dav for NT to use with my OS X webdav client.

Cheers, G. Steel

[ Reply to This | # ]

Use WebDAV to share files with all platforms
Authored by: micrology on Oct 19, '04 01:12:02PM

I also have this error. Did anyone find a work around? I am installing WebDAV on MacOS X Server, but this shouldn't make a difference here. After installing regardless, webDAV works from a Mac, but from Windows XP, the user/pw is rejected in just the same way as before I started installing mod_encoding.

To encourage me, does anyone have MacOS X Server, webdav and access from Win XP actually working for them?



[ Reply to This | # ]
mod_encoding will not build with Apache2
Authored by: oblahdioblidaa on Nov 05, '08 03:58:31PM
Has anyone had success building 'mod_encoding' with Apache2? It invariably fails for me on Leopard, even trying a patch as per these instructions.

[ Reply to This | # ]