Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > NEW easier, faster better WebDAV from your Mac

NEW easier, faster better WebDAV from your Mac
Thread Tools
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 12, 2002, 07:28 PM
 
WARNING: This doesn't work YET. STill trying to fugure it out (originally I thought I had it working).

I'm trying to find a way to make WebDAV work generically for any user on the Mac, so that once set up the user just has to create a "WebDAV" directory in their home directory (and optionally appropriate ".htaccess" and ".htpasswd" files). I looked up some stuff at the Apache web site, and came up with the following implementation which doesn't quite work (but is very close).

The instructions below include a universal usernames/passwords file which will be the default for any users who create their own WebDAV directory, but they can easily override that by adding their own passord file and referring to it in a ".htaccess" file (instructions at the end).

----------------------------------

Here's what you need to allow any OS X user to easily create their own WebDAV service:

Edit (as root) the file,

/etc/httpd/httpd.conf

Uncomment the following two lines (ie, remove the preceeding "#"):

Code:
LoadModule dav_module libexec/httpd/libdav.so AddModule mod_dav.c
(NB: The above two lines are NOT together in the file. In the original file they have preceeding "#".)

At the end of the file add the following lines:

Code:
<IfModule mod_dav.c> AliasMatch /WebDAV/(.*) /Users/$1/WebDAV <Directory /Users/*/WebDAV> AllowOverride AuthConfig AuthName "WebDAV" AuthUserFile /Library/WebServer/htpasswd AuthType Basic <Limit MKCOL PUT DELETE LOCK UNLOCK COPY MOVE PROPFIND PROPPATCH> Require valid-user </Limit> DAV On </Directory> </IfModule> DAVLockDB /Library/WebServer/DAVLocks/DAVLockDB DAVMinTimeout 600
You will need to create the DAVLockDB file and make it writable by the www user. Eg (as root, or using sudo),

Code:
mkdir /Library/WebServer/DAVLocks touch /Library/WebServer/DAVLocks/DAVLockDB chown -R root:www /Library/WebServer/DAVLocks chmod -R 770 /Library/WebServer/DAVLocks
Then run the following command (as root or using sudo) to restart the apache web server:

/usr/sbin/apachectl graceful

That's all that's needed to enable this for any user that wants to take advantage of it!

Now any user can have a WebDAV served directory by creating a directory called "WebDAV" directly under their home directory (NOT withing the "Sites" directory), and they need to make sure that directory is accessible by the www user. Eg (as the user, except the chgrp as root or sudo):

Code:
mkdir /Users/<username>/WebDAV sudo chgrp www /Users/<username>/WebDAV chmod 770 /Users/<username>/WebDAV
Each user also needs to be added to a apache user/password file (to get authorised access). This can be a universal password file (default) or a per user password file (implemented for each WebDAV service) - it's up to the user wich they want to use.

For a universal (default) password file, you need to do the following for the each user (as root or with sudo):

Code:
/usr/bin/htpasswd -c /Library/WebServer/htpasswd <username>
Then enter a password for that user to access WebDAV services as prompted.

After doing this for the first user, you should set appropriate permissions for this new file (as root or with sudo):

Code:
chmod 770 /Library/WebServer/htpasswd chown root:www /Library/WebServer/htpasswd
For a per-WebDAV service (ie, per-OS-X-user) password file

If a user wants to control who has WebDAV access to their own WebDAV share, they can override the authorisation settings by creating their own password file and an ".htaccess" file. To do this, the user needs to create a file,

/Users/<username>/WebDAV/.htaccess

and enter any of the authorisation information that they want to override. Usually this will just be the password file and perhaps the service name. To do this enter the content of the .htaccess file as:

Code:
AuthName "<username>'s WebDAV Service!!!" AuthUserFile /Users/<username>/.htpasswd
Then create the personal password file using the command:

Code:
htpasswd -c /Users/<username>/.htpasswd <username>
There... all done. Each use can do this to set whatever users and passwords they want to have access to their WebDAV service. They can even add a .htgroup file and configure groups with different levels of access if they wish... it's all up to them and the system administrator doesn't have to worry about configuring anything for each user.
( Last edited by Brass; Sep 13, 2002 at 12:20 AM. )
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 12, 2002, 07:33 PM
 
Oh, I should add the (perhaps obvious) addition, that once this is set up, you can connect to the WebDAV service using the Finder, or iCal, or any other WebDAV savvy application using the URL:

http://<hostname-or-IP>/WebDAV/<username>

(you'll need to enter the http username and password).

To connect in the Finder, user the Go -> Connect to Server command (CMD-K) and then enter the above URL for your particular setup.
     
Patton76
Junior Member
Join Date: Sep 2001
Location: Belgium
Status: Offline
Reply With Quote
Sep 12, 2002, 10:29 PM
 
I again tried all of the above, but everytime Itry to connet with Apple K, I get a -36 error.

I tried many ways of enabling webdav, but untill now, no go.

Any help would be appreciated.

Is there a way to see if webdav is running ok?
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 12, 2002, 11:05 PM
 
hmmm... I'm having some -36 errors too. i can connect, but cannot write to the DAV service using my "easier" method above

However, I can get it to work using my sumarised method in the other thread.

The "*" must be causing some problem, I think.

However, I also found that the other method (in the other thread) only works if in an included file and not directly in the httpd.conf file (don't know why this would be though). Eg, it works if the DAV configuration is in a file called /etc/httpd/users/<username> (such files are automatically included by the httpd.conf file), so long as it so lon gas the directives reference one fixed directory/alias and doesn't use the "*" notation for alias matching and directory directives.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Sep 12, 2002, 11:06 PM
 
What do you see when you do a "tail" of your error_log file (in Apache's "logs" folder)?
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 12, 2002, 11:15 PM
 
Well, if I remove everything I've added to the httpd.conf file, and just have it's LoadModule and AddModule lines uncommented, and create a file,

/etc/httpd/users/WebDAV

(which automatically gets loaded by the standard httpd.conf file) and give that file the following contents below.

Then The first WebDAV servicd "/testdav" works fine... I can read and write to it, but the second one (which is supposed to be generic for all users) will allow me to connect, and browse files, but I cannot write to it (-36 erros).

Any Apache configuration experts care to enlighten me?

Both �/testdav and �/WebDAV have full write access by www.

Code:
<IfModule mod_dav.c> Alias /testdav /Users/brass/testdav <Directory /Users/brass/testdav> AllowOverride AuthConfig AuthName "WebDAV" AuthUserFile /Library/WebServer/htpasswd AuthType Basic <Limit MKCOL PUT DELETE LOCK UNLOCK COPY MOVE PROPFIND PROPPATCH> Require valid-user </Limit> DAV On </Directory> AliasMatch /WebDAV/(.*) /Users/$1/WebDAV <Directory /Users/*/WebDAV> AllowOverride AuthConfig AuthName "WebDAV" AuthUserFile /Library/WebServer/htpasswd AuthType Basic <Limit MKCOL PUT DELETE LOCK UNLOCK COPY MOVE PROPFIND PROPPATCH> Require valid-user </Limit> DAV On </Directory> DAVLockDB /Library/WebServer/DAVLocks/DAVLockDB DAVMinTimeout 600 </IfModule>
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 12, 2002, 11:22 PM
 
Originally posted by besson3c:
What do you see when you do a "tail" of your error_log file (in Apache's "logs" folder)?
I should have checked this earlier!

When I mount the WebDAV service (using the Finder) it mounts, but I get the apache error (in the log) twice:

File does not exist: /Users/<username>/.autodiskmounted/WebDAV

When I try to copy the file "blah" from my desktop to the WebDAV server, apache logs the error:

File does not exist: /Users/<username>blah/WebDAV

Maybe I've got the syntax a bit wrong for that WebDAV service (see my post above)?
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Sep 12, 2002, 11:25 PM
 
Brass:

what happens if you give the questionable directory full access

chmod -R a+rwx

if it still doesn't work, then it's not a permission problem. If this is the case, what do you see when you:

tail /var/log/httpd/error_log
apachectl configtest
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 12, 2002, 11:35 PM
 
Originally posted by besson3c:
Brass:

what happens if you give the questionable directory full access

chmod -R a+rwx

if it still doesn't work, then it's not a permission problem. If this is the case, what do you see when you:

tail /var/log/httpd/error_log
apachectl configtest
If I do a chmod 777 for that directory, I get the same error.


However, I've discovered something else. If I change the <Directory /Users/*/WebDAV> directive to a <Location /WebDAV> directive, I don't get any errors when I try to mount the share, but when I try to copy the file "blah" to it, the following error is logged:

(2)No such file or directory: Missing one or more intermediate collections. Cannot create resource /WebDAV/brass/blah. [409, #0]

I think there must be something wrong with my apache configuration.
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 12, 2002, 11:52 PM
 
Okay, I've done some more fiddling with my configuration...

If I change the "AliasMatch" line to a straight "Alias" directive (for the WebDAV directory in my home directory only - ie, for one user instead of all users), it works fine.

But this defeats the whole purpose of what I was trying to do *sigh*. Any idea of how I can get it work with the AliasMatch (or similar).

NB: It would actually mount correctly with the AliasMatch, but would have problems using it afterwards.
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 13, 2002, 12:12 AM
 
Okay, as I've said I've isolated the problem a bit more. Here's contents of the file,

/etc/httpd/users/WebDAV

(which is automatically included by httpd.conf):

Code:
<IfModule mod_dav.c> AliasMatch ^/WebDAV/(.*) /Users/$1/WebDAV #Alias /WebDAV/brass /Users/brass/WebDAV <Directory /Users/*/WebDAV> DAV On </Directory> DAVLockDB /Library/WebServer/DAVLocks/DAVLockDB DAVMinTimeout 600 </IfModule>
If left as above it does NOT work. However, if I comment out the AliasMatch line and uncomment the Alias line above, it DOES work (for exactly the same directory).

Does anyone know a way around this problem?
( Last edited by Brass; Sep 13, 2002 at 12:45 AM. )
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 13, 2002, 12:44 AM
 
[oops... replied instead of edited]
     
dtriska
Mac Elite
Join Date: Sep 2000
Location: Canada
Status: Offline
Reply With Quote
Sep 13, 2002, 01:19 AM
 
As per http://www.webdav.org/mod_dav/install.html#apache, I believe you made a couple of mistakes with the lock database. First, you need only to create the "www" read and write directory, and not the actual file DAVLockDB as you have done. Second, in your httpd.conf file, you should reference only the read/write directory and mod_dav will create the file(s) as necessary. Change "DAVLockDB /Library/WebServer/DAVLocks/DAVLockDB" to "DAVLockDB /Library/WebServer/DAVLocks" and let us know what happens.
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Sep 13, 2002, 01:55 AM
 
Originally posted by dtriska:
As per http://www.webdav.org/mod_dav/install.html#apache, I believe you made a couple of mistakes with the lock database. First, you need only to create the "www" read and write directory, and not the actual file DAVLockDB as you have done. Second, in your httpd.conf file, you should reference only the read/write directory and mod_dav will create the file(s) as necessary. Change "DAVLockDB /Library/WebServer/DAVLocks/DAVLockDB" to "DAVLockDB /Library/WebServer/DAVLocks" and let us know what happens.
Your partly correct. You should really let apache create the file, but if you touch the file yourself, it shouldn't really matter (as proved by the fact that I can access the WebDAV service correctly when using Alias instead of AliasMatch).

However, I've already looked at the page you linked at it states that you should reference the FILE and NOT the DIRECTORY that the file should go in...

add a DAVLockDB directive at the top-level of your configuration file (i.e. outside of a <Directory> or <Location> directive). This directive should specify a filename that mod_dav will create.
     
dtriska
Mac Elite
Join Date: Sep 2000
Location: Canada
Status: Offline
Reply With Quote
Sep 13, 2002, 03:04 AM
 
Originally posted by Brass:
However, I've already looked at the page you linked at it states that you should reference the FILE and NOT the DIRECTORY that the file should go in...
Yup, sorry about that.
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:02 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,