RCurl SSH public key authentication failed: Callback returned error

1.7k views Asked by At

I need to get config file from the Linux server that is authenticated using ssh keys. I am stuck with "Callback returned error" message.

conf = scp(host="10.10.10.10", path="/home/admin/codebase/config.txt", 
        user="admin", keypasswd = "", verbose=TRUE,
        key=c("C:/echinn/.ssh/my_public_key", "C:/echinn/.ssh/my_private_key"))

I get the following output

*   Trying 10.10.10.10...
* Connected to 10.10.10.10 (10.10.10.10) port 22 (#0)
* SSH MD5 fingerprint: 8fa4562037d2f1e68c7ff419f9dc7656
* SSH authentication methods available: publickey,gssapi-keyex,gssapi-with-mic
* Using SSH public key file 'C:/echinn/.ssh/my_public_key'
* Using SSH private key file 'C:/echinn/.ssh/my_private_key'
* SSH public key authentication failed: Callback returned error
* Failure connecting to agent
* Authentication failure
* Closing connection 0
Error in function (type, msg, asError = TRUE)  : Authentication failure

I also tried with "getURL()" but ended up with the same error. I am able to successfully connect using putty and WinSCP with (.ppk format of) the same public/private keys.

On the Linux server /var/log/secure I see the following for every execution

sshd[xxxx]: Connection closed by x.x.x.x [preauth]
1

There are 1 answers

0
G106863 On

From the R Documentation for the scp function, it looks like your key does not have a passphrase, so try setting keypasswd = NA or removing the argument altogether.