redhat/centos7.4系统的openssh服务存在bug,会导致主机Hostbase互信失败,需要升级ssh应用到最新,下载最新系统光盘,提取Packages中的openssh,openssh-server,openssh-client三个软件包后rpm -ivh rpm包即可。
开启主机互信功能:
echo 'HostbasedAuthentication yes'>>/etc/ssh/ssh_config
echo 'EnableSSHKeysign yes'>>/etc/ssh/ssh_config
echo 'HostbasedAuthentication yes'>>/etc/ssh/sshd_config
编辑/tmp/hosts,格式为每行 hostname,ip地址:
host1,192.168.0.101
host2,192.168.0.102
创建/etc/ssh/shosts.equiv,格式为 hostname
host1
host2
收集所有host key:
ssh-keyscan -t rsa -f /tmp/hosts >> /etc/ssh/ssh_known_hosts
重启服务:
systemctl restart sshd