<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Control WebPanel Wiki &#187; WebDAV</title>
	<atom:link href="https://wiki.centos-webpanel.com/tag/webdav/feed" rel="self" type="application/rss+xml" />
	<link>https://wiki.centos-webpanel.com</link>
	<description>CentOS WebPanel Wiki</description>
	<lastBuildDate>Wed, 12 Feb 2025 20:38:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>Enable WebDAV Per User Basis</title>
		<link>https://wiki.centos-webpanel.com/enable-webdav-per-user-basis</link>
		<comments>https://wiki.centos-webpanel.com/enable-webdav-per-user-basis#comments</comments>
		<pubDate>Tue, 16 Feb 2021 23:06:51 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[WebDAV]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1546</guid>
		<description><![CDATA[WebDAV is for remote file Upload, manipulation, and editing Usage. WebDAV stands for Web Distributed Authoring and Versioning, which is an extension of HTTP that lets clients edit/view remote content on the web. This tutorial will guide you on how you can enable WebDAV for your user accounts. Hardness :Medium Requirements (main) : php 7.1 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>WebDAV is for remote file Upload, manipulation, and editing Usage. WebDAV stands for Web Distributed Authoring and Versioning, which is an extension of HTTP that lets clients edit/view remote content on the web.</p>
<p>This tutorial will guide you on how you can enable WebDAV for your user accounts.</p>
<p><strong>Hardness :</strong>Medium<br />
<strong>Requirements (main) :</strong> php 7.1 and above and Apache webserver</p>
<h3><strong>Step 1 :</strong></h3>
<p>Download and install composer</p>
<pre>curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
chmod 755 /usr/local/bin/composer
</pre>
<h3><strong>Step 2 :</strong></h3>
<p>Install SabreDAV- WebDav php based</p>
<pre>su -l username -s /bin/bash
cd /home/username/public_html
git clone https://github.com/sabre-io/dav.git
cd dav
/opt/alt/php-fpm71/usr/bin/php /usr/local/bin/composer install
or
"use your own php 7.1 bin path" /usr/local/bin/composer install
mkdir data
</pre>
<p>**replace "username" with you User account name.</p>
<p>you can use PHP switcher or PHP selector or php-fpm</p>
<p>Now create an index.php file in dav directory</p>
<pre>nano index.php
</pre>
<p>and add this script in it and save:</p>
<p><script src="https://pastebin.com/embed_js/JXgDRPMz?theme=dark"></script><br />
you can edit it like below to change the desired directory :</p>
<pre>$rootDirectory = new DAV\FS\Directory('/home/username/public_html');
</pre>
<p>Fix the permission :</p>
<pre>chmod 755 /home/username/public_html/dav
chmod 644 /home/username/public_html/dav/index.php
</pre>
<h3>Step 3 :</h3>
<p>As <strong>root</strong> user now you need to enable the Apache WebDAV modules and it sub required modules :</p>
<pre>mod_alias, 
mod_auth_digest, 
mod_authn_core, 
mod_authn_file,
mod_authz_core, 
mod_authz_user, 
mod_dav, 
mod_dav_fs,
mod_setenvif
</pre>
<p>got to <strong>/usr/local/apache/conf/httpd.conf </strong>and uncomment (remove the # from the first line of each required module) and uncomment (remove the # ) <strong>Include "conf/extra/httpd-dav.conf"</strong> file in <strong>httpd.conf</strong></p>
<p>Next you also need to add the Directory directive to the domain/subdomain vhost which you want to activate webdav :</p>
<p>for ssl vhost :</p>
<pre>   &lt;Directory "/home/username/public_html/dav"&gt;
		AllowOverride All
		SSLRequireSSL
		Require all granted
   &lt;/Directory&gt;
</pre>
<p>for non ssl vhost :</p>
<pre>	&lt;Directory "/home/username/public_html/dav"&gt;
		AllowOverride All
		Require all granted
	&lt;/Directory&gt;</pre>
<p>*** ensure you added this in main domain vhost i.e. usually under first one and in tag : &lt;VirtualHost 1.1.1.1:443&gt; &lt;/VirtualHost&gt;</p>
<p>after changes restart httpd server :</p>
<pre>systemctl restart httpd</pre>
<h3><strong>Step 4 :</strong></h3>
<p>Adding authentication to webdav access</p>
<p>In user DAV domain dir <strong>/home/username/public_html/dav</strong> create <strong>.htaccess</strong> add this rules for <strong>digest auth</strong> and <strong>rewrite rule</strong> :</p>
<pre>RewriteRule (.*) index.php [L]
AuthType Digest
AuthName "dav"
AuthDigestDomain /
AuthUserFile /home/username/.htpasswd
Require user username-dav
Satisfy All
</pre>
<p>**replace username with user account username<br />
***replace username-dav with the dav user name you created with htdigest command below</p>
<p>And create .htpasswd in <strong>/home/username</strong> and add the digest auth, you need to use htdigest :</p>
<pre>htdigest -c /home/username/.htpasswd dav admin
</pre>
<p>**replace username with user account username</p>
<p>enter the password when prompted.</p>
<blockquote><p>eg :<br />
admin:dav:595a268370390fe3e20cfffdd583d610</p>
<p>here :-<br />
username-dav : admin<br />
realm : dav<br />
pass : 595a268370390fe3e20cfffdd583d610</p></blockquote>
<h3><strong>Step 5 :</strong></h3>
<p>Accessing webdav via domain</p>
<p>go to <strong>https://www.yourdomain.tld/dav</strong> or <strong>http://www.yourdomain.tld/dav</strong></p>
<p>or you can use command line or <strong>webdav client</strong> in this eg I'm using <strong>cadaver</strong> package cli :</p>
<pre>cadaver https://www.yourdomain.tld/dav</pre>
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/enable-webdav-per-user-basis/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
