【发布时间】:2012-09-05 18:34:01
【问题描述】:
我正在使用RCurl 包中的ftpUpload 函数将文件上传到sftp 文件服务器。我在进行身份验证调用时遇到了困难。
以下是我的电话:
ftpUpload(what = "some-file.png",
to = "sftp://some-ftp-server.com:22/path/to/some-file.png",
verbose = TRUE,
userpwd = "my_userid:my_password")
结果我得到:
* About to connect() to some-ftp-server.com port 22 (#0)
* Trying some-ftp-server.com... * connected
* Connected to some-ftp-server.com (some ip address) port 22 (#0)
* SSH authentication methods available: publickey,password
* Using ssh public key file /home/.ssh/id_dsa.pub
* Using ssh private key file /home/.ssh/id_dsa
* SSH public key authentication failed: Unable to open public key file
* Authentication failure
* Closing connection #0
Error in function (type, msg, asError = TRUE) : Authentication failure
我不是设置 sftp 服务器的人,而且我有点 ssh 菜鸟——抱歉。我所知道的是,我可以通过 Filezilla 使用 my_userid 和 my_password 登录,并且服务器有一个 .htaccess 和 .htpasswd 文件。
我希望有某种方法可以使用ftpUpload 仅使用我的用户名和密码进行身份验证。似乎password 是两种可用方法之一,但我似乎无法让ftpUpload 理解我想单独使用后者。
.htpasswd 文件似乎包含my_userid:my_password,但密码部分已加密。我愿意将其加载到某个位置以供ftpUpload 访问,但我不确定如何将ftpUpload 指向正确的方向。
最后,我尝试使用并查看此处列出的 libcurl 选项:http://www.omegahat.org/RCurl/philosophy.html 并在此处进行更全面的解释:http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
唉,运气不好。任何帮助表示赞赏!
【问题讨论】: