linux ssh 无法连接解决

1 篇文章 0 订阅

环境: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  

但是还是不知道这是为什么希望大家来   吐个槽,告诉小弟我谢谢

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值