<?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>Soul Of Free Loop &#187; 坚果云</title>
	<atom:link href="https://zohead.com/archives/tag/nutstore/feed/" rel="self" type="application/rss+xml" />
	<link>https://zohead.com</link>
	<description>Uranus Zhou&#039;s Blog</description>
	<lastBuildDate>Sat, 19 Jul 2025 15:42:46 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8</generator>
	<item>
		<title>解决Linux下使用davfs2挂载坚果云的问题</title>
		<link>https://zohead.com/archives/davfs2-nutstore/</link>
		<comments>https://zohead.com/archives/davfs2-nutstore/#comments</comments>
		<pubDate>Wed, 28 Oct 2015 16:53:51 +0000</pubDate>
		<dc:creator><![CDATA[Uranus Zhou]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[davfs2]]></category>
		<category><![CDATA[WebDAV]]></category>
		<category><![CDATA[云存储]]></category>
		<category><![CDATA[坚果云]]></category>

		<guid isPermaLink="false">http://zohead.com/?p=1068</guid>
		<description><![CDATA[坚果云算是现在国内云存储提供商里比较另类的一个了，没有提供巨大的容量空间，也没有非常多的人使用他的分享功能，但好在基本功能非常全面，桌面同步客户端做的比较清爽，各种类型的客户端基本都能支持，特别像多个用户协作修改文件的同步、文件版本历史这些我比较看重的功能做的还不错。坚果云也有一定的付费用户，稍微坑一点的就是坚果云免费用户的初始容量只有 1GB，之后每个月免费用户可以再上传 1GB 的数据（免费用户同时限制每个月下行流量 3GB）。 坚果云虽然没有提供 API 功能，但好在其算是国内唯一提供 WebDAV 方式访问的网盘（国外的类似网盘也比较少，免费的像 Box.com 就算一个了），这样基本 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><span style="line-height: 1.5em;">坚果云算是现在国内</span>云存储提供商里比较另类的一个了，没有提供巨大的容量空间，也没有非常多的人使用他的分享功能，但好在基本功能非常全面，桌面同步客户端做的比较清爽，各种类型的客户端基本都能支持，特别像多个用户协作修改文件的同步、文件版本历史这些我比较看重的功能做的还不错。坚果云也有一定的付费用户，稍微坑一点的就是坚果云免费用户的初始容量只有 1GB，之后每个月免费用户可以再上传 1GB 的数据（免费用户同时限制每个月下行流量 3GB）。</p>
<p>坚果云虽然没有提供 API 功能，但好在其算是国内唯一提供 WebDAV 方式访问的网盘（国外的类似网盘也比较少，免费的像 Box.com 就算一个了），这样基本就可以在各种不同类型的客户端中不依靠其同步客户端就能读写云中的数据。之前我在 Windows 上使用自带的资源管理器以 WebDAV 方式访问坚果云看起来没什么问题，但到 Linux 下使用最流行的 davfs2 软件挂载坚果云 WebDAV 的时候却直接报错无法访问（WebDAV 功能需要在坚果云账户设置中的 “第三方应用管理” 里开启）。</p>
<p>Linux 终端下 davfs2 挂载坚果云的报错信息如下：</p>
<pre class="brush: bash; title: ; notranslate">
(trusty)root@localhost:~# mount -t davfs https://dav.jianguoyun.com/dav /mnt
Please enter the username to authenticate with server
https://dav.jianguoyun.com/dav or hit enter for none.
  Username: xxx@qq.com
Please enter the password to authenticate user xxx@qq.com with server
https://dav.jianguoyun.com/dav or hit enter for none.
  Password:
/sbin/mount.davfs: mounting failed; the server does not support WebDAV
</pre>
<p>直接提示服务器不支持 WebDAV 这就比较奇怪的，在网上没找到解决办法，因此决定直接下载 davfs2 源代码进行分析，davfs2 现在的项目主页已从 SourceForge 迁移到：</p>
<p><a href="http://savannah.nongnu.org/projects/davfs2" target="_blank">http://savannah.nongnu.org/projects/davfs2</a></p>
<p>使用 cvs 检出源代码之后（还用这么古老的版本管理软件值得吐槽哈），需要先安装 WebDAV 支持库 libneon 才能正常编译。</p>
<p>很快就能找到出错的地方 webdav.c：</p>
<pre class="brush: cpp; title: davfs2/src/webdav.c; notranslate">
int
dav_init_connection(const char *path)
{
    char *spath = ne_path_escape(path);
    ne_server_capabilities caps = {0, 0, 0};
    int ret = ne_options(session, spath, &amp;caps);

    if (!ret) {
        initialized = 1;
        if (!caps.dav_class1 &amp;&amp; !ignore_dav_header) {
            if (have_terminal) {
                error(EXIT_FAILURE, 0,
                      _(&quot;mounting failed; the server does not support WebDAV&quot;));
            } else {
                syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR),
                       _(&quot;mounting failed; the server does not support WebDAV&quot;));
                ret = EINVAL;
            }
        }
</pre>
<p>简单分析上面的源代码可知 mount.davfs 命令在挂载时和 WebDAV 服务器建立连接，并通过 libneon 库的 ne_options 函数发送 HTTP OPTIONS 请求获取 WebDAV 服务器能力，虽然返回成功但判断坚果云 WebDAV 服务器不支持 Class 1 WebDAV，因此直接报错挂载失败。</p>
<p>看到这里解决办法也就简单了，davfs2 提供了通过配置文件禁用 WebDAV 头检测的功能，直接修改 <strong>/etc/davfs2/davfs2.conf</strong> 配置文件注释并改为：</p>
<p><strong>ignore_dav_header 1</strong></p>
<p>然后再重新使用 mount 或者 mount.davfs 命令挂载坚果云就可以成功了，后续拷贝文件之类的看起来也算正常，不过运行 df 命令看到 WebDAV 返回的容量信息还是不对：</p>
<pre class="brush: bash; title: ; notranslate">
(trusty)zzm@localhost:~$ df -h /mnt
文件系统                        容量  已用  可用 已用% 挂载点
https://dav.jianguoyun.com/dav   26G   13G   13G   50% /mnt
</pre>
<p>不过这个就不用计较咯，祝玩的开心～～～</p>
]]></content:encoded>
			<wfw:commentRss>https://zohead.com/archives/davfs2-nutstore/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
