ssh远程登录报错:

[transfor@fortress ~]$ ssh     198.44.241.34

ssh_exchange_identification: read: Connection reset by peer


初步原因锁定:

1-服务器防火墙限定,

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

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


解决方案:

1 firewall-cmd --list-all-zones

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


2 w 查看当天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    查看最近登录日志



扩展:Linux命令之远程登录/无密码登录-ssh,ssh-keygen,ssh-copy-id

        http://www.it165.net/os/html/201402/7315.html