RCurl SSH公钥身份验证失败:回调返回错误

时间:2016-12-27 23:04:28

标签: r ssh scp rcurl geturl

我需要从使用ssh密钥验证的Linux服务器获取配置文件。我遇到了“Callback返回错误”消息。

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"))

我得到以下输出

*   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

我也试过“getURL()”,但结果却出现了同样的错误。我能够使用putty和WinSCP成功连接(.ppk格式)相同的公钥/私钥。

在Linux服务器/ var / log / secure上,每次执行都会看到以下内容

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

1 个答案:

答案 0 :(得分:0)

From the R Documentation for the scp function,您的密钥看起来没有密码短语,因此请尝试设置keypasswd = NA或完全删除参数。