rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.2]

当在远程服务器和本地服务器传文件时,遇到如下报错:

zhongjia@hpc108-PowerEdge-R730:~/install-package$ rsync -avP ./Anaconda3-5.1.0-Linux-x86_64.sh [email protected]:/home/zhongjia/@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /home/zhongjia/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/zhongjia/.ssh/known_hosts:2
  remove with:
  ssh-keygen -f "/home/zhongjia/.ssh/known_hosts" -R "10.10.138.105"
ECDSA host key for 10.10.138.105 has changed and you have requested strict checking.
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.2]
 

报错原因:

我的服务器重装了系统(清除了与我本地SSH连接协议相关信息),本地的SSH协议信息便失效了。SSH连接相同的ip地址时因有连接记录直接使用失效的协议信息去验证该ip服务器,所以会报错

解决办法:

根据标红的部分命令ssh-keygen -f "/home/zhongjia/.ssh/known_hosts" -R "10.10.138.105"

更新本地服务器上的known_hostst文件

更新完后重新执行传递文件命令即可

rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.2]_第1张图片 网上也有说:

rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.2]_第2张图片

也是可以的。

特别是当我在windows服务器上ssh 映射远程服务器端口时,也报错:

C:\Users\user>ssh-keygen -f "/home/zhongjia/.ssh/known_hosts" -R "10.10.138.105"
mkstemp: No such file or directory

因为我不知道windows的known_hosts.old文件在哪里,所以用ssh-keygen -R "远程服务器ip"

C:\Users\user>ssh-keygen -R "10.10.138.105"
# Host 10.10.138.105 found: line 3
C:\Users\user/.ssh/known_hosts updated.
Original contents retained as C:\Users\user/.ssh/known_hosts.old

 

如果提示:Updating known_hosts is not supported in Windows yet.

则去   相应ssh目录下找到C:\Users\zhongjia\.ssh 找到known_hosts文件更改即可打开known_hosts文件,删除对应IP的行即可

C:\Users\user>ssh -L 8009:localhost:8888 [email protected]
The authenticity of host '10.10.138.105 (10.10.138.105)' can't be established.
ECDSA key fingerprint is SHA256:oEdN6ryPkNDxO6qfT7jfLL+t8pTNTBj6db78RzvBotk.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.138.105' (ECDSA) to the list of known hosts.
[email protected]'s password:
Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-101-generic x86_64)Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-101-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Thu Jul  9 11:42:47 UTC 2020

  System load:  19.29             Processes:              455
  Usage of /:   3.3% of 25.07TB   Users logged in:        5
  Memory usage: 43%               IP address for eno1:    10.10.138.105
  Swap usage:   25%               IP address for docker0: 172.17.0.1

 * "If you've been waiting for the perfect Kubernetes dev solution for
   macOS, the wait is over. Learn how to install Microk8s on macOS."

   https://www.techrepublic.com/article/how-to-install-microk8s-on-macos/

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

21 packages can be updated.
0 updates are security updates.

Your Hardware Enablement Stack (HWE) is supported until April 2023.

*** System restart required ***
Last login: Thu Jul  9 11:13:14 2020 from 10.10.254.138

你可能感兴趣的:(linux)