I'm using the ftpUpload
function in the RCurl
package to upload files to an sftp file server. I'm having difficulty working out the authentication call.
Below is my call:
ftpUpload(what = "some-file.png",
to = "sftp://some-ftp-server.com:22/path/to/some-file.png",
verbose = TRUE,
userpwd = "my_userid:my_password")
As a result I get:
* 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
I wasn't the one to setup the sftp server, and I'm somewhat of an ssh noob -- apologies. What I do know is that I'm able to login using my_userid
and my_password
with Filezilla and that the server has an .htaccess
and .htpasswd
file.
I'm hoping that there is some way to authenticate using ftpUpload
with just my userid and password. It seems that password
is one of the two available methods, but I can't seem to get ftpUpload
to understand that I'd like to use the later alone.
The .htpasswd
file seems to contain my_userid:my_password
, though the password portion is encrypted. I'm open to loading that in a certain place for ftpUpload
to access, but I'm not sure how to point ftpUpload
in the right directions.
Finally, I've tried playing around with and looking through the libcurl options listed here: http://www.omegahat.org/RCurl/philosophy.html and more fully explained here: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
Alas, no luck. Any help appreciated!