日期:2014-05-16  浏览次数:20642 次

Linux SSH登陆错误解决办法
SSH登陆错误解决办法:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
21:24:59:ba:53:d7:51:a2:12:13:40:09:53:03:5b:e6.
Please contact your system administrator.
Add correct host key in /home/cmccpay/.ssh/known_hosts to get rid of this message.
Offending key in /home/cmccpay/.ssh/known_hosts:11
RSA host key for 10.202.76.27 has changed and you have requested strict checking.
Host key verification failed.


出现该错误的解决方法:

    1.因为在本地机器上曾经用SSH登录过这台远程计算机,因而留下了known_hosts的记录,在远程计算机重新安装系统后不能够通过鉴权。删除~/.ssh/known_hosts中对应的项目,问题获得解决。(很麻烦。。忽视之)

    2.在客户端执行下述指令即可:$mv ~/.ssh/known_hosts /tmp    (相对好一点,用过)
    再次登录后会出现最初需要增加条目:
    The authenticity of host '128.112.139.3 (128.112.139.3)' can't be established.
    RSA key fingerprint is ce:78:c2:d5:26:11:42:cf:c6:e6:65:99:9c:60:51:34.
    Are you sure you want to continue connecting (yes/no)? The authenticity of host '132.170.3.32 (132.170.3.32)' can't be established.
    RSA key fingerprint is 91:14:9c:ea:e7:43:5d:8b:57:aa:51:57:e0:28:06:52.
    Are you sure you want to continue connecting (yes/no)? yes
  
   3. 配置文件进行配置,使出现“Warning: Host identification has changed!”时候可以自动更新~/.ssh/known_hosts中的相应条目,而不出现提示。(比较好!方便,无需后期处理)
    OpenSSH 有三种配置方式:命令行参数、用户配置文件和系统级的配置文件("/etc/ssh/ssh_config")。命令行参数优先于配置文件,用户配置文件优先于系统配置文件。所有的命令行的参数都能在配置文件中设置。因为在安装的时候没有默认的用户配置文件,所以要把"/etc/ssh /ssh_config"拷贝并重新命名为"~/.ssh/config"。
    (下一篇中具体介绍ssh的配置文件)
    注意在配置文件~/.ssh/config中修改下面的内容:
   
Host *
            GSSAPIAuthentication yes
            BatchMode yes
            StrictHostKeyChecking no