今天碰到ssh失败有两种:
1,ssh: connect to host 192.168.1.100 port 22: Connection refused
2,ssh_exchange_identification: read: Connection reset by peer
用ssh相连的两台电脑:笔记本ubuntu13.10:haoyu@192.168.1.104,台式机ubuntu12.04LTS:sandy@192.168.1.100
第一种失败产生的原因及解决办法:
ssh的对象没有安装openssh-server,例如我的本本要ssh台式机:
在ssh sandy@192.168.1.100之前,需要在台式机上安装:sudo apt-get install openssh-server
第二种失败产生及解决办法:
由于我之前改了/etc/hosts.deny文件,我把#ALL: PARANOID的注释去掉了,现在改回来就ok了。网上查得:/etc/hosts.allow控制可以访问本机的IP地址,/etc/hosts.deny控制禁止访问本机的IP。如果两个文件的配置有冲突,以/etc/hosts.deny为准。所以虽然/etc/hosts.allow我也改了也没关系,只把ALL: PARANOID注释掉就可以了。
paranoid的意思是:
-
adj. 类似妄想狂的;属于偏执狂的
-
n. 患妄想狂的人;偏执狂患者
-
估计是说所有的其他电脑想进入我的电脑那是妄想吧~~呵呵~~
-
ps:
-
第三种:
-
今天又出现一个错误错,当我连接台式机的时候:ssh sandy@192.168.1.100,出现如下错误,
-
-
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-
@ WARNING: REMOTE HOST IDENTIFICATION HAS @
-
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING
-
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
-
It is also possible that a host key has just been changed.
-
The fingerprint for the ECDSA key sent by the remote host is
-
3a:ab:0e:62:7a:0e:db:40:ac:95:46:0e:05:63:93:ee.
-
Please contact your system administrator.
-
Add correct host key in /home/haoyu/.ssh/known_hosts to get rid of this message.
-
Offending ECDSA key in /home/haoyu/.ssh/known_hosts:6
-
remove with: ssh-keygen -f "/home/haoyu/.ssh/known_hosts" -R 192.168.1.100
-
ECDSA host key for 192.168.1.100 has changed and you have requested strict checking.
-
Host key verification failed.
猜测应该是我本本的动态ip地址改变了,导致与以前的钥匙匹配不上,根据提示更新钥匙链,在本本上输入:
-
remove with: ssh-keygen -f "/home/haoyu/.ssh/known_hosts" -R 192.168.1.100
显示:
-
# Host 192.168.1.100 found: line 6 type ECDSA
-
/home/haoyu/.ssh/known_hosts updated.
-
Original contents retained as /home/haoyu/.ssh/known_hosts.old
重新ssh连接:
出现:
-
The authenticity of host '192.168.1.100 (192.168.1.100)' can't be established.
ECDSA key fingerprint is 3a:ab:0e:62:7a:0e:db:40:ac:95:46:0e:05:63:93:ee.
Are you sure you want to continue connecting (yes/no)?
输入:yes,再输入密码就可以重新连接了。
-
-
总结:如果在ubuntu12.04和13.10系统下想被ssh用,只是需要安装openssh-server就可以了,配置不需要更改了。
阅读(8285) | 评论(0) | 转发(0) |