论坛风格切换切换到宽版
  • 1700阅读
  • 9回复

[问题求助]ssh远程登陆问题 [复制链接]

上一主题 下一主题
离线梅花鹿.
 
发帖
1942
C币
-235492
威望
403
贡献值
1
银元
-4
铜钱
4610
人人网人气币
0
只看楼主 倒序阅读 使用道具 楼主  发表于: 2009-05-01
在一个网段,比如192..168.1. ,可以正常登陆,而换一个网段,如192.168.2.就无法正常登陆,putt.y提示(        游戏          )
netwo.rk error: Software caused connection .abort    外汇

把./etc/hosts.allow,hosts.deny 里tcp-.wrapper相关属性设置清理了.,iptables -F清理了防火墙都不能解决问题。健康
请教是何原因?

用与此.服务器在同一ip网段的Linux主机连接.,竟然提示--------------彩票
Connec.tion reset by peer电脑
也是无法登陆,是什么原因啊?

[ 本帖最.后由. 飞行员舒克 于 2007-5-31 08:34 编辑 ]电影


最佳答案straw
http://upload.bbs.csuboy.com/Mon_1004/126_6660_c2515fb4e40125e.gif[/img]重点检查该sshd服务器的sshd_config的配置    健康
这台机器是缺省配置么?


评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
离线luwei571.
发帖
2027
C币
-198760
威望
366
贡献值
1
银元
0
铜钱
4488
人人网人气币
0
只看该作者 沙发  发表于: 2010-04-13
重点检查该sshd服务器的sshd_config的配置
这台机器是缺省配置么?


离线tnka.
发帖
2076
C币
-60326
威望
404
贡献值
1
银元
-3
铜钱
4803
人人网人气币
0
只看该作者 板凳  发表于: 2010-04-13
贴出192.168.2网段内的机器PING SSHD机器的结果。


离线yueyehan.
发帖
2105
C币
-235151
威望
397
贡献值
1
银元
-3
铜钱
4728
人人网人气币
0
只看该作者 地板  发表于: 2010-04-13
ping的结果:(202.204.209.201是服务器,202.204.209.202是用于登陆的Linux主机)
[root@mail ~]# ping 202.204.209.201

PING 202.204.209.201 (202.204.209.201) 56(84) bytes of data.

64 bytes from 202.204.209.201: icmp_seq=0 ttl=64 time=1.46 ms

64 bytes from 202.204.209.201: icmp_seq=1 ttl=64 time=0.263 ms

64 bytes from 202.204.209.201: icmp_seq=2 ttl=64 time=0.263 ms

64 bytes from 202.204.209.201: icmp_seq=3 ttl=64 time=0.268 ms

64 bytes from 202.204.209.201: icmp_seq=4 ttl=64 time=0.276 ms

64 bytes from 202.204.209.201: icmp_seq=5 ttl=64 time=0.278 ms



--- 202.204.209.201 ping statistics ---

6 packets transmitted, 6 received, 0% packet loss, time 5003ms

rtt min/avg/max/mdev = 0.263/0.468/1.464/0.445 ms, pipe 2
复制代码
ssh的结果:
[root@mail ~]# ssh 202.204.209.201

root@202.204.209.201's password:

Read from remote host 202.204.209.201: Connection reset by peer

Connection to 202.204.209.201 closed.
复制代码
__________________________________________________________________
另外一台Windows主机ping的结果,这台主机用putty登陆显示network error: Software caused connection abort

Microsoft Windows [版本 5.2.3790]

(C) 版权所有 1985-2003 Microsoft Corp.



C:\Documents and Settings\Administrator>ping 202.204.209.201



Pinging 202.204.209.201 with 32 bytes of data:



Reply from 202.204.209.201: bytes=32 time<1ms TTL=64

Reply from 202.204.209.201: bytes=32 time<1ms TTL=64

Reply from 202.204.209.201: bytes=32 time<1ms TTL=64

Reply from 202.204.209.201: bytes=32 time<1ms TTL=64



Ping statistics for 202.204.209.201:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 0ms, Average = 0ms
复制代码
[ 本帖最后由 飞行员舒克 于 2007-5-31 08:31 编辑 ]


离线laoli521.
发帖
1941
C币
-236087
威望
354
贡献值
1
银元
-4
铜钱
4476
人人网人气币
0
只看该作者 4楼 发表于: 2010-04-13
你在本机上先ssh localhost试试,然后再ssh 本机IP试试
把结果粘贴出来


发帖
2086
C币
-60314
威望
409
贡献值
1
银元
-1
铜钱
4738
人人网人气币
0
只看该作者 5楼 发表于: 2010-04-13
[root@CNU root]# ssh localhost

ssh_exchange_identification: Connection closed by remote host



[root@CNU root]# ssh 202.204.209.201

Warning: Permanently added '202.204.209.201' (RSA) to the list of known hosts.

Read from remote host 202.204.209.201: Connection reset by peer

Connection to 202.204.209.201 closed.
复制代码
[ 本帖最后由 飞行员舒克 于 2007-5-31 08:31 编辑 ]


离线58008839.
发帖
1973
C币
-235726
威望
381
贡献值
1
银元
0
铜钱
4410
人人网人气币
0
只看该作者 6楼 发表于: 2010-04-13
/etc/hosts.allow没有localhost的即127.0.0.1,添加进去后ssh localhost出现下面状况:
[root@CNU root]# ssh localhost

Warning: Permanently added 'localhost' (RSA) to the list of known hosts.

Read from remote host localhost: Connection reset by peer

Connection to localhost closed.
复制代码
贴出hosts.allow内容:


[root@CNU root]#  cat /etc/hosts.allow

#

# hosts.allow   This file describes the names of the hosts which are

#               allowed to use the local INET services, as decided

#               by the '/usr/sbin/tcpd' server.

#

# ip 192.168.121.226 is owned by YaoJianzhuang in his dometry.

sshd:202.204.209. 192.168.101. 192.168.96. 192.168.121. 127.0.0.1
复制代码iptables:


[root@CNU root]# iptables -L

Chain INPUT (policy ACCEPT)

target     prot opt source               destination

Chain FORWARD (policy ACCEPT)

target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)

target     prot opt source               destination
复制代码
[ 本帖最后由 飞行员舒克 于 2007-5-31 08:36 编辑 ]


离线sisikie.
发帖
2119
C币
-60363
威望
375
贡献值
1
银元
-7
铜钱
4641
人人网人气币
0
只看该作者 7楼 发表于: 2010-04-13
>重启 SSH service or reboot
>服务器是否多网卡,如是则检查每个网段路由设置
>是否因防火墙规则阻断或启用selinux、tcp wrappers,可暂时disable
>检查SSH版本,两端是否一致
>确认SSH服务侦听端口是否是22
>确认SSH配置是否允许ROOT直接登陆
>从SSH server和一台linux 主机运行 tcpdump或wireshark,分析报文
>Last but not least   pray then play  


离线magicworm.
发帖
1957
C币
-199353
威望
335
贡献值
1
银元
-1
铜钱
4296
人人网人气币
0
只看该作者 8楼 发表于: 2010-04-13
sshd_config为默认配置,内容如下:
Host *
        CheckHostIP             no
        ForwardX11              yes
        ForwardAgent            yes
        StrictHostKeyChecking   no
        UsePrivilegedPort       no
        FallBackToRsh           no
        Protocol                2,1


离线h1821388.
发帖
2209
C币
-235179
威望
414
贡献值
1
银元
-6
铜钱
4968
人人网人气币
0
只看该作者 9楼 发表于: 2010-04-13
谢谢大家,已经找到问题所在,如下:

/etc/security/sshd.conf
-:ALL:ALL EXCEPT 192.168.96.

所以只允许96段的访问
谢谢大家!!!
很抱歉耽误大家时间!

这10分就给straw 了,只有他的还比较接近(当然,此答案不是我服务器情况的答案),谢谢!
其它人很抱歉了!

[ 本帖最后由 飞行员舒克 于 2007-5-31 11:53 编辑 ]

快速回复
限100 字节
批量上传需要先选择文件,再选择上传
 
上一个 下一个