ssh连接遇到的问题

来源:互联网 发布:考研培训班 网络 编辑:程序博客网 时间:2024/04/30 08:27

以下是在CentOS下使用SSH的时遇到的一些问题以及解决方法

一、要想通过主机名进行连接需要进行以下设置

    1、编辑/etc/sysconfig/network

         将HOSTNAME的值改为你想要的名字如master。注:此名字为在网络上使用的名字

     2、编辑/etc/hosts

         在此文件后边添加同网下的一些信息如以下所示。注:此信息需要在每一台机器上进行相同的设置

         

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.253.133 master192.168.253.135 slave1192.168.253.136 slave2


 

     3、配置完成之后重启生效

二、连接过程中的问题

     如果提示以下信息

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@The RSA host key for master has changed,and the key for the corresponding IP address 192.168.253.133is unchanged. This could either mean thatDNS SPOOFING is happening or the IP address for the hostand its host key have changed at the same time.Offending key for IP in /root/.ssh/known_hosts:2@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@    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 is90:95:df:11:d3:50:43:98:58:ed:f1:95:c7:c3:58:c3.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:3RSA host key for master has changed and you have requested strict checking.Host key verification failed.

只需把用户目录下的.ssh目录下的known_hosts删除及可

rm -f known_hosts


 

此时重新连接及可