简体   繁体   English

SSH主机密钥Rsync问题

[英]SSH Host Key Rsync Issue

I have a bash script which uses rsync to pull down backups of my server to an offline server I have running Ubuntu. 我有一个bash脚本,该脚本使用rsync将服务器的备份下拉到运行Ubuntu的脱机服务器。

But it does not seem my offline server wants to run this script right. 但是看来我的脱机服务器不想正确运行此脚本。 And the issue I get when I run it manually run it is, 我手动运行它时遇到的问题是,

Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(226) [Receiver=3.1.1]

But heres the thing, the host key is fine and works when I SSH. 但是事情很奇怪,主机密钥很好,并且在我进行SSH时可以使用。 So logging on to my offline server and from there logging into the remote server works without any issues. 因此,登录到我的脱机服务器并从那里登录到远程服务器可以正常工作。

Here is where the issue gets very odd, the bash script works (when asked to run via webmin) after I have SSHed into the offline server. 这是问题变得很奇怪的地方,当我通过SSH进入离线服务器后,bash脚本有效(当要求通过webmin运行时)。 I dont have to do anything else, just login to the remote server and the bash script will work. 我无需执行其他任何操作,只需登录到远程服务器,bash脚本即可工作。

That is what I dont understand, if the host keys are not configured right, then they should not work at all, but they do, once I have logged into the server? 那是我不明白的,如果主机密钥配置不正确,那么它们根本不应该工作,但是一旦我登录到服务器,它们就可以工作吗?

Thanks, 谢谢,

Try to login with ssh -a to prevent your ssh-agent to be forwarded. 尝试使用ssh -a登录,以防止转发您的ssh-agent。 You probably use an identiy in your agent to authenticate to the target Server. 您可能在代理中使用一个身份对目标服务器进行身份验证。 This authentication will not work if your ssh-agent ist not present. 如果您的ssh-agent ist不存在,则此身份验证将不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM