我一直在尝试使用RCurl和SFTP连接并列出文件。我认为,我的价值观可能在错误的地方。这是我从WinSCP获得的.NET汇编代码C#(我正在尝试将其复制到R以获取连接)。
Protocol = Protocol.Sftp,
HostName = "sftp.website.com",
UserName = "username",
Password = "pswrd",
SshHostKeyFingerprint = "gibberish",
sessionOptions.AddRawSettings("ProxyMethod", "2");
sessionOptions.AddRawSettings("ProxyHost", "somerandom.looking.com");
sessionOptions.AddRawSettings("ProxyPort", "8080");
sessionOptions.AddRawSettings("ProxyUsername", "proxy_user");
sessionOptions.AddRawSettings("ProxyPassword", "proxy_pswrd");
我在R中尝试过的操作如下:
library(RCurl)
opts <- curlOptions(
proxytype = 2,
proxy = "somerandom.looking.com",
proxyport = 8080,
proxyusername = "proxy_user",
proxypassword = "proxy_pswrd",
ssh.private.keyfile = "gibberish"
)
url <- "sftp://username:pswrd@sftp.website.com/"
getURL(url = url, .opts = opts, dirlistonly = TRUE)
Error in function (type, msg, asError = TRUE) :
Failure establishing ssh session
我遗漏了什么?价值观是否在错误的地方?
答案 0 :(得分:0)
最后解决了。我不得不更改代理并添加用户名和密码。
opts <- curlOptions(
proxy = "http://mynewproxy/",
proxyport = 8080,
proxyusername = "domain\\user",
proxypassword = "pwd",
httpproxytunnel = 1L,
ssh.private.keyfile = "ssh-gibberish"
)
通常代理使用Windows passowrds,但我怀疑这是不同的。