【发布时间】:2012-03-18 12:42:01
【问题描述】:
我需要在 Ubuntu 上以编程方式挂载 WebDAV 文件夹。我找到了使用 davfs2 的解决方案。
但是 davfs2 在 Ubuntu 上默认没有安装。同时 Gnome 'Places->Connect to Server...' 菜单可以在不安装 davfs2 的情况下做到这一点。我认为它也不需要root权限。
任何想法如何在不安装 davfs2 的情况下安装 WebDAV?
【问题讨论】:
我需要在 Ubuntu 上以编程方式挂载 WebDAV 文件夹。我找到了使用 davfs2 的解决方案。
但是 davfs2 在 Ubuntu 上默认没有安装。同时 Gnome 'Places->Connect to Server...' 菜单可以在不安装 davfs2 的情况下做到这一点。我认为它也不需要root权限。
任何想法如何在不安装 davfs2 的情况下安装 WebDAV?
【问题讨论】:
Ubuntu 上已经安装了一个命令行工具:nd。但这需要一直输入用户名和密码。
如果您可以从源代码构建 WebDAV 客户端,例如 cadaver
您可以使用configure 处的--prefix 选项并选择您具有写入权限的文件夹:
./configure --prefix=/home/me/cadaver/
make
make install
cadaver 支持自动登录到需要通过 .netrc 文件进行身份验证的服务器
【讨论】:
Ubuntu 有一个cadaver package 可用于所有当前支持的版本,因此不需要编译。您可以使用命令sudo apt-get install cadaver 安装它正如JScoobyCed 所提到的“尸体支持自动登录到需要通过.netrc 文件进行身份验证的服务器”
以下是手册页的一些摘录:
THE .netrc FILE
The file ~/.netrc may be used to automatically login to a server
requiring authentication. The following tokens (separated by spaces,
tabs or newlines) may be used:
machine host
Identify a remote machine host which is compared with the host‐
name given on the command line or as an argument to the open
command. Any subsequent tokens up to the end of file or the
next machine or default token are associated with this entry.
default
This is equivalent to the machine token but matches any host‐
name. Only one default token may be used and it must be after
all machine tokens.
login username
Specifies the username to use when logging in to the remote
machine.
password string
passwd string
Specifies the password to use when logging in to the remote
machine.
Any other tokens (as described in ftp(1)) are ignored.
EXAMPLES
cadaver http://dav.example.com/
Connects to the server myserver.example.com, opening the root collection.
cadaver http://zope.example.com:8022/Users/fred/
Connects to the server zope.example.com using port 8022, opening the collection "/Users/fred/".
cadaver https://secure.example.com/
Connects to a server called secure.example.com using SSL.
FILES
~/.cadaverrc
Individual user settings that can override cadaver defaults and to script cadaver. Can be changed by the "--rcfile" option.
~/.netrc
Login and initialization information used by the auto-login process. See section "THE .netrc FILE" for details.
【讨论】: