在 R 中使用 Rcurl 的 SCP 函数 [英] Using SCP function from Rcurl in R

查看:44
本文介绍了在 R 中使用 Rcurl 的 SCP 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地使用 PuTTY 测试了我的 SSH 身份验证,这意味着我可以使用提供的私钥 ssh 到远程服务器.但是,我试图在 R 中使用 Rcurl 包中的 SCP 函数,我收到错误消息:

I have tested my SSH authentication using PuTTY with success, which I mean I can ssh to remote server using the private key provided. However, I am trying to use SCP function from Rcurl package in R, I got the error message saying:

函数错误(类型、味精、asError = TRUE):身份验证失败

Error in function (type, msg, asError = TRUE) : Authentication failure

这是我的代码

r <- scp(host='eee.com', path = "/aaa/bbb/test.sas7bdat", 
         keypasswd = NA, user = "yyyyyy", rsa = TRUE, 
         key = "C:/Users/.ssh/authorized_keys", binary = NA)

C:/Users/.ssh/authorized_keys 是我的私有 RSA 密钥.

C:/Users/.ssh/authorized_keys is my private RSA key.

推荐答案

问题是key"必须同时包含公钥和私钥.这应该有效:

the problem is that "key" must contain both the public and the private key. This should work:

r <- scp(host='eee.com', path = "/aaa/bbb/test.sas7bdat", keypasswd = NA, user = "yyyyyy", rsa = TRUE, key = c("C:/Users/.ssh/authorized_keys.pub","C:/Users/.ssh/authorized_keys"), binary = NA)

这篇关于在 R 中使用 Rcurl 的 SCP 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆