RCurl sftp 与代理的连接
RCurl sftp connection with proxy
我一直在尝试使用 RCurl 和 SFTP 连接并列出文件。我可以通过 WinSCP 访问它,但 RCurl 不会通过。这是我目前所在的位置:
library(RCurl)
opts <- curlOptions(
proxy = "http://myproxy/",
proxyport = 8080,
httpproxytunnel = 1L,
ssh.private.keyfile = "ssh-gibberish"
)
url <- "sftp://user:pwd@ftp.address.com/"
test <- getURL(url = url, .opts = opts, dirlistonly = TRUE, verbose = TRUE, port = 22)
* Trying 123.12.123.12...
* Connected to myproxy (123.12.123.12) port 8080 (#0)
* Establish HTTP proxy tunnel to ftp.address.com:22
> CONNECT ftp.address.com:22 HTTP/1.1
Host: ftp.address.com:22
Proxy-Connection: Keep-Alive
* Proxy CONNECT aborted
* Connection #0 to host myproxy left intact
Error in function (type, msg, asError = TRUE) : Proxy CONNECT aborted
终于解决了。我不得不更改代理并添加用户名和密码。
opts <- curlOptions(
proxy = "http://mynewproxy/",
proxyport = 8080,
proxyusername = "domain\user",
proxypassword = "pwd",
httpproxytunnel = 1L,
ssh.private.keyfile = "ssh-gibberish"
)
通常代理使用 windows 密码,但我想这是不同的。
我一直在尝试使用 RCurl 和 SFTP 连接并列出文件。我可以通过 WinSCP 访问它,但 RCurl 不会通过。这是我目前所在的位置:
library(RCurl)
opts <- curlOptions(
proxy = "http://myproxy/",
proxyport = 8080,
httpproxytunnel = 1L,
ssh.private.keyfile = "ssh-gibberish"
)
url <- "sftp://user:pwd@ftp.address.com/"
test <- getURL(url = url, .opts = opts, dirlistonly = TRUE, verbose = TRUE, port = 22)
* Trying 123.12.123.12...
* Connected to myproxy (123.12.123.12) port 8080 (#0)
* Establish HTTP proxy tunnel to ftp.address.com:22
> CONNECT ftp.address.com:22 HTTP/1.1
Host: ftp.address.com:22
Proxy-Connection: Keep-Alive
* Proxy CONNECT aborted
* Connection #0 to host myproxy left intact
Error in function (type, msg, asError = TRUE) : Proxy CONNECT aborted
终于解决了。我不得不更改代理并添加用户名和密码。
opts <- curlOptions(
proxy = "http://mynewproxy/",
proxyport = 8080,
proxyusername = "domain\user",
proxypassword = "pwd",
httpproxytunnel = 1L,
ssh.private.keyfile = "ssh-gibberish"
)
通常代理使用 windows 密码,但我想这是不同的。