ssh 错误

机器登录发生ssh_exchange_identification: Connection closed by remote host

原因是:

/var/empty/sshd 这个文件夹被删

建下就ok

#!/bin/bash
touch /var/run/utmp
chmod 664 /var/run/utmp
mkdir -p /var/empty/sshd
chmod 711 /var/empty/sshd
service sshd restart

 

ssh_exchange_identification: read: Connection reset by peer

OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: connect port:22, options.port:22
debug1: Connecting to <machine_name> [10.58.94.74] port 22.
debug1: Connection established.
debug1: identity file /home/aaa/.ssh/identity type -1
debug1: identity file /home/aaa/.ssh/id_rsa type -1
debug1: identity file /home/aaa/.ssh/id_dsa type -1
ssh_exchange_identification: read: Connection reset by peer

 

初步原因锁定:

1-服务器防火墙限定,

2-是否达到ssh的最大连接数,超过之后会服务器端会拒绝新的连接,直到有新的连接释放出来

3-/etc/hosts.allow和/etc/hosts.deny配置文件限定ip登录

4-磁盘满了

解决方案:

1 firewall-cmd --list-all-zones

    查看pubilic.xml和ssh.xml两个防火墙配置文件,是否放通指定ip

2 查看当天ssh远程连接数,是否达到最大连接数

   #vim /etc/ssh/sshd_config

     #LoginGraceTime 2m    参数表示登录验证时间

     #MaxAuthTries 6    最大验证重试次数

     #MaxSessions 10    最大远程连接数

3 vim /etc/hosts.all和vim /etc/hosts.deny查看限定的ip

[root@cp-apache02 ssh]# cat /etc/hosts.allow 

# hosts.allowThis file contains access rules which are used to

#allow or deny connections to network services that

#either use the tcp_wrappers library or that have been

#started through a tcp_wrappers-enabled xinetd.

#

#See ‘man 5 hosts_options‘ and ‘man 5 hosts_access‘

#for information on rule syntax.

#See ‘man tcpd‘ for information on tcp_wrappers

sshd:122.10.70.66

 

4 查看ssh用户登录日志/var/log/secure

    tail -20 /var/log/secure    

or

    #less /var/log/messages    查看最近系统操作信息

or

    #last    查看最近登录日志

Did not receive identification string from

 

转载于:https://my.oschina.net/u/347414/blog/730066

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值