Advertisement
Guest User

Untitled

a guest
Jul 1st, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. webdav
  2.  
  3. 1. What is WebDAV?
  4. 2. WebDAV stands for Web-based Distributed Authoring and Versioning. It was designed to allow groups of individuals to edit and manage files stored on a web-server. The protocol allows the creation of "web-shares" which can be used for file storage, collaborative projects, editing websites themselves, and any number of other things. WebDAV supports features like editing, copying, and moving of files, file locks, resource lists, and file property modification. Most operating systems, including MS Windows, support WebDAV directories. Install the Proper Software
  5. The first thing you will need (obviously) is a functioning apache2 webserver. If you happened to have install Ubuntu Server Edition with the LAMP option, then you're set. Otherwise, you'll need to get a few things with apt. Do this however you want; I will use the command line. While you're at it, you might as well get PHP to go with it.
  6.  
  7.  
  8. apt-get install apache2 php5 libapache2-mod-php5
  9.  
  10. 3. Add Modules
  11. Fortunately, Apache 2.x comes with mod_dav already installed, we just have to activate it. We can do this by making some symlinks.
  12.  
  13.  
  14. cd /etc/apache2/mods-enabled
  15. ln -s ../mods-available/dav* .
  16.  
  17. 4. Create LockDB file for WebDAV
  18. Next we need to set up a DAVLockDB file for WebDAV to use. This is a very important step, as you'll wind up with Internal Server Errors if you try to use WebDAV without it.
  19.  
  20.  
  21. mkdir /usr/share/apache2/var
  22. touch /usr/share/apache2/var/DAVLock
  23. chown -R www-data:www-data /usr/share/apache2/var
  24.  
  25. 5. Setup Authentication and Add Users
  26. WebDAV can open your web server up to security risks. You don't want just anyone to wander in and change your files! There are several ways you can do authentication for your WebDAV directory, but htpasswd is the easiest and probably best for most cases. We'll make the passwords using MD5 and store them where we store the apache configurations and add an initial user while we're at it.
  27.  
  28.  
  29. htpasswd -m -c /etc/apache2/.htpasswd
  30.  
  31. 6. You can use this command to add more users later or change their passwords. Just remember to remove the -c option or you'll truncate your password db every time! Create the WebDAV Directory
  32. Okay, almost done. Let's make a directory in our web document root where we will run our WebDAV. I'm calling it myWebDAV. This is the folder in which your authorized users will be able to add, delete, and modify files. The directory will need to be writable by the web server.
  33.  
  34.  
  35. mkdir /var/www/myWebDAV
  36. chown www-data:www-data /var/www/myWebDAV
  37.  
  38. 7. Configure Apache
  39. Now all we need to tell Apache how to use WebDAV and where to enable it. This consists of adding a few definitions to the user-defined config file at /etc/apache2/httpd.conf. Open that file with an editor and add lines similar to those below.
  40.  
  41.  
  42. ## Location of the DavLock file
  43. DavLockDB /usr/share/apache2/var/DavLock
  44.  
  45. ## Set up the myWebDAV directory to use WebDAV and authentication
  46. <Directory "/var/www/myWebDAV">
  47. Dav On
  48. AuthName "WebDAV Login"
  49. AuthType Basic
  50. AuthUserFile /etc/apache2/.htpasswd
  51. ## Limit access for enhanced security
  52. <LimitExcept GET HEAD OPTIONS POST>
  53. require valid-user
  54. </LimitExcept>
  55. Order allow,deny
  56. Allow from all
  57. </Directory>
  58.  
  59. 8. Restart Apache and Test
  60. That's it! Restart your web server and you're good to go. You and your friends/coworkers/etc can now login and modify the files at http://your.domain.com/myWebDAV.
  61.  
  62.  
  63. /etc/init.d/apache2 restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement