centos spc 出错

阅读更多

  重装系统后,从另一台机器中scp文件,出现了如下提示,重装前是可以scp的。

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
62:7c:e9:74:26:2b:58:cb:7c:45:53:6a:65:be:9f:2e.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:1
RSA host key for 192.168.7.171 has changed and you have requested strict checking.
Host key verification failed.
lost connection
     百度了一下,立马解决,又一次真的感谢网络的便捷,网友的无私共享。

方法如下:

在运行scp的机器中,找到该用户家目录下的如下的ssh连接文件夹:
1. cd ~/.ssh/
2. vi known_hosts
3. 找到和远程主机ip一致的密钥保存信息,直接dd删除,然后:x保存退出
4. 重新连接,输入密码,发现连接成功

问题解决。原来是记录了重装前的密钥,所以出现错误。删除后重新获取就OK了。

scp的一般命令:

传送文件:  scp filename username@ip:dir,如scp a.txt [email protected]:/home/aa

传送文件夹:scp -r dir username@ip:dir, 如scp -r bb [email protected]:/home/aa

你可能感兴趣的:(scp)