环境:oracle linux6.3 64bit 3台
ip:分别为192.168.137.11(normal_11.localdomain)、192.168.137.12(normal_12.localdomain)、192.168.137.13(normal_13.localdomain)
使用账户:chenhao01
描述:在做批量分时发现 ssh使用不了显示lost connection
错误演示(我用的自己ip是192.168.137.11):
[root@normal_11 ~]# scp -r id_rsa.pub 192.168.137.12:/home/chenhao01/.ssh/authorized_keys
The authenticity of host '192.168.137.12 (192.168.137.12)' can't be established.
RSA key fingerprint is 90:76:fa:52:e6:38:ce:4d:eb:84:4e:cf:4a:c1:7d:ed.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.137.12' (RSA) to the list of known hosts.
Connection closed by 192.168.137.12
lost connection
解决思路:当时也是在google搜索
Warning: Permanently added '192.168.137.12' (RSA) to the list of known hosts.这个错误,他们都说要修改/etc/ssh/ssh_config或/etc/ssh/sshd_config发现都没用。
这时我想起之前在做oracle rac时要配置双机信任,其中在 /etc/hosts文件中有相关的ip映射。于是就试一试在192.168.137.11的hosts文件加上看看。
[chenhao01@normal_11 .ssh]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.137.11 normal_11.localdomain
192.168.137.12 normal_12.localdomain
192.168.137.13 normal_13.localdomain
结果发现真的通了。
[chenhao01@normal_11 .ssh]$ scp -r id_rsa.pub 192.168.137.12:/home/chenhao01/.ssh/authorized_keys
chenhao01@192.168.137.12's password:
id_rsa.pub 100% 413 0.4KB/s 00:00
但是还是不知道这是为什么希望大家来 吐个槽,告诉小弟我谢谢