Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 使用R system()命令进行ssh_Linux_R_Ssh - Fatal编程技术网

Linux 使用R system()命令进行ssh

Linux 使用R system()命令进行ssh,linux,r,ssh,Linux,R,Ssh,当我尝试使用ssh和R的system()命令将计算机A连接到计算机B时,我得到一个错误: system('ssh root@Bs-ip-address') ssh_askpass: exec(rpostback-askpass): No such file or directory Host key verification failed. lost connection 但是如果我在Linux终端(ssh)中输入引号中的命令root@Bs-ip地址)它工作正常(ssh密钥是为正确的用户设置

当我尝试使用ssh和R的
system()
命令将计算机A连接到计算机B时,我得到一个错误:

system('ssh root@Bs-ip-address')

ssh_askpass: exec(rpostback-askpass): No such file or directory
Host key verification failed.
lost connection
但是如果我在Linux终端(
ssh)中输入引号中的命令root@Bs-ip地址
)它工作正常(ssh密钥是为正确的用户设置的)。如何使用R的
system()
命令正确连接?或者你能建议一种更好的联系方式吗

这可能与需要在Linux中出现的以下提示中输入“yes”有关:

The authenticity of host Bs-ip-address (Bs-ip-address) cant be established.
ECDSA key fingerprint is unique-fingerprint.
Are you sure you want to continue connecting (yes/no)?

在putty会话中输入一次“是”后,上面的R
system()
命令将起作用。但我不想每次都进入油灰中。(作为旁注,我正在使用预设ssh密钥创建许多相同的Digital Ocean实例,并尝试从R连接到它们,因此每次为每个新实例输入putty会话都不是一个可行的选项。)您可以使用
system()

发送一个“yes”命令吗(注意:你必须确保你要访问的机器是可信的!)

例如,如果主机具有rsa密钥,则可以执行以下操作:

system( 'ssh-keyscan  -t rsa Bs-ip-address  >> ~/.ssh/known_hosts' )

您好。

请参阅Jeroen Ooms针对SSH的R软件包:谢谢,我们没有调查此软件包,但它看起来很有希望!下面接受的解决方案就是我所需要的一切。如您所示。sweet:)。。。很高兴听到这个消息。