https://wiki.archlinux.org/api.php?action=feedcontributions&user=Spyder2013&feedformat=atomArchWiki - User contributions [en]2024-03-29T13:22:36ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=WebDAV&diff=261089WebDAV2013-06-04T13:08:58Z<p>Spyder2013: /* Server (Apache) */</p>
<hr />
<div>[[Category:Networking]]<br />
{{Merge|WebDAV authentication|Same topic.}}<br />
WebDAV('''Web''' '''D'''istributed '''A'''uthoring and '''V'''ersioning) is an extension of HTTP 1.1 and therefore can be considered to be a procotol. It contains a set of concepts and accompanying extension methods to allow read and write across the HTTP 1.1 protocol. Instead of using [[NFS]] or [[Samba|SMB]], WebDAV offers file transfers via HTTP. <br />
<br />
The goal of this how to is to setup a simple WebDAV configuration using Apache.<br />
<br />
See also [[File Sharing with Webdav and DNSSD]].<br />
<br />
== Server (Apache) ==<br />
Install Apache as explained in the [[LAMP]] article.<br />
<br />
Now enable WebDAV. Add the following line to {{ic|/etc/httpd/conf/httpd.conf}}.<br />
DAVLockDB /home/httpd/DAV/DAVLock<br />
<br />
Make sure you add it outside of any other directives, for instance right under the {{ic|DocumentRoot}} definition.<br />
<br />
Next, add the following (also outside of any directives):<br />
{{bc|<br />
Alias /dav "/home/httpd/html/dav"<br />
<br />
<Directory "/home/httpd/html/dav"><br />
DAV On<br />
AllowOverride None<br />
Options Indexes FollowSymLinks<br />
Order allow,deny<br />
Allow from all<br />
</Directory><br />
}}<br />
<br />
=== Create directories ===<br />
<br />
# mkdir -p /home/httpd/DAV<br />
<br />
Check the permissions of DavLockDB's directory and insure it is writable by the apache user (http):<br />
# chown -R http:http /home/httpd/DAV # Otherwise you wouldn't be able to upload files<br />
<br />
# mkdir -p /home/httpd/html/dav<br />
# chown -R nobody.nobody /home/httpd/html/dav<br />
<br />
== Client (Cadaver) ==<br />
Cadaver is a command line WebDAV client. It can be installed with the package {{Pkg|cadaver}}, available in the [[official repositories]].<br />
<br />
=== Test it ===<br />
# cadaver http://localhost/dav<br />
dav:/dav/> mkcol test<br />
Creating `test': succeeded.<br />
dav:/dav/> ls<br />
Listing collection `/dav/': succeeded.<br />
Coll: test<br />
dav:/dav/> exit<br />
<br />
If the above worked as shown, then you are good to go.<br />
<br />
== Authentication ==<br />
Make sure you add permissions for viewing and dav access to the directory, and maybe even make that directory ssl access only.<br />
<br />
There are numerous different protocols you can use:<br />
* plain<br />
* digest<br />
* others<br />
<br />
Two examples follow, in which {{ic|foo}} is the username:<br />
<br />
Using digest:<br />
# basic form: htdigest -c /path/to/file AuthName username<br />
htdigest -c /etc/httpd/conf/passwd WebDAV foo<br />
<br />
{{Note|Make sure digest authentication is enabled in {{ic|httpd.conf}} by the presence of this entry: {{ic|LoadModule auth_digest_module modules/mod_auth_digest.so}}}}<br />
<br />
Using plain:<br />
# basic form: htpasswd -c /path/to/file username<br />
htpasswd -c /etc/httpd/conf/passwd foo<br />
<br />
Next, {{ic|httpd.conf}} must be edited to enable authentication. One method would be to require the user {{ic|foo}} for everything:<br />
{{bc|<br />
<Directory "/home/httpd/html/dav"><br />
DAV On<br />
AllowOverride None<br />
Options Indexes FollowSymLinks<br />
Order allow,deny<br />
AuthType Digest # substitute "Basic" for "Digest" if you used htpasswd above<br />
AuthName "WebDAV"<br />
AuthUserFile /etc/httpd/conf/passwd<br />
Require user foo<br />
Allow from all<br />
</Directory><br />
}}<br />
<br />
{{Note|{{ic|AuthName}} must match the name passed when using the {{ic|htdigest}} command for digest authentication. For basic/plain authentication, this line may be removed. Also, make sure that the {{ic|AuthUserFile}} path matches that used with the {{ic|htdigest}} or {{ic|htpasswd}} commands above}}<br />
<br />
If you want to permit everybody to read, you could use this in your httpd.conf<br />
{{bc|<br />
<Directory "/home/httpd/html/dav"><br />
DAV On<br />
AllowOverride None<br />
Options Indexes FollowSymLinks<br />
Order allow,deny<br />
AuthType Digest # substitute "Basic" for "Digest" if you used htpasswd above<br />
AuthName "WebDAV"<br />
AuthUserFile /etc/httpd/conf/passwd<br />
Allow from all<br />
<LimitExcept GET HEAD OPTIONS PROPFIND><br />
require user foo<br />
</LimitExcept><br />
</Directory><br />
}}<br />
<br />
Don't forget to restart apache after making changes!<br />
# systemctl restart httpd</div>Spyder2013