Quantcast
Channel: RV3 » UNIX
Viewing all articles
Browse latest Browse all 5

WebDAV

$
0
0

WebDAV is part of Apache server, and is at the core of all on-line services like calendars and shared documents. Some experience with Terminal is preferred, and you should be familiar with executing UNIX commands. This tutorial is done on a Mac, but any other platform follows the same rules.

  1. Start Apache. (If you haven’t already) 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.
  2. Enable WebDAV support in Apache. Edit the file /etc/apache2/httpd.conf, (remember to use sudo to edit it) and locate this line:
    LoadModule dav_module libexec/apache2/mod_dav.so

    Make sure it is not commented (there should be no “#” at the beginning of the line.) Then locate this line (towards the bottom of the file):

    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.

  3. Configure WebDAV. Next, edit the file /etc/apache2/extra/httpd-dav.conf. Add a section in it to create our new WebDAV share. Here’s what the new section should look like. As a security precaution, you should also go ahead and delete the /usr/uploadsshare that is set by default.
    Alias /webdav "/Library/WebServer/WebDAV"
    
    <Directory "/Library/WebServer/WebDAV">
      Dav On
    
      Order Allow,Deny
      Allow from all
    
      AuthType Basic
      AuthName WebDAV-Realm
      AuthUserFile "/usr/webdav.passwd"
    
      <LimitExcept GET OPTIONS>
        require user YourUserName
      </LimitExcept>
    </Directory>

    On line 1, the name following the Alias keyword is the URL you’d like for your new WebDAV share. If you want the share to be located at http://your-server-name/your-fancy-webdav-share, then line 1 should read:

    Alias /your-fancy-webdav-share "/Library/WebServer/WebDAV"

    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. Remember not to use a particularly important password for this account.

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

  4. Create user accounts and passwords. Use the htpasswdtool to create your password file.
    sudo htpasswd -c /usr/webdav.passwd "YourUserName"
    New password:
    Re-type new password:
    Adding password for user YourUserName
  5. Create the necessary directories.
    sudo mkdir -p /Library/WebServer/WebDAV
    sudo mkdir -p /usr/var
  6. Setup permissions correctly.
    sudo chown -R www:www /Library/WebServer/WebDAV
    sudo chown -R www:www /usr/var
    sudo chgrp www /usr/webdav.passwd
  7. Restart Apache gracefully.
    sudo apachectl graceful
  8. Test your server. Optionally, you can test your WebDAV configuration using litmus, a WebDAV server test tool. It is distributed as source code with no binaries, so you will need to compile it first, for which you will need Apple’s Developer Tools. You can test your server manually by using a graphical client such as Goliath. Try uploading a file and see if you can access it again.

Viewing all articles
Browse latest Browse all 5

Trending Articles