Using RCURL with SFTP

I am trying to use ftpUploadRCurl for the first time.

The site I'm trying to access uses the sftp protocol. I have definitely installed the libcurl version, which includes the ability to make secure connections.

SFTP is listed among the protocols available for RCurl:

curlVersion()$protocols
[1] "dict"   "file"   "ftp"    "ftps"   "gopher"
[6] "http"   "https"  "imap"   "imaps"  "ldap"  
[11] "pop3"   "pop3s"  "rtmp"   "rtsp"   "scp"   
[16] "sftp"   "smtp"   "smtps"  "telnet" "tftp"

However, when I run the function fileUpload, I get:

ftpUpload(what = "some_file.png",
          to = "userid:password@sftp://ec2-some-server-ip.compute-1.amazonaws.com")

Error in function (type, msg, asError = TRUE)  : 
Couldn't resolve host 'sftp'

I also tried to break useridand passwordout in terms of parameterization, but I get the same answer.

Any suggestions would be appreciated.

+5
source share
1 answer

The user ID and password must be after the protocol (therefore, you cannot find the sftp host error):

ftpUpload(what = "some_file.png",
      to = "sftp://userid:password@ec2-some-server-ip.compute-1.amazonaws.com:22/path/some_file.png")

, , , .

+2

All Articles