当你登录一台linux机器,登录不了,出现Connection reset by peer 报错,请参照以下解决步骤:

     1、ssh -vvv -p22  123.10.98.22  

如:

localhost:~$ ssh -vvv -p22 123.10.98.22

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011

debug1: Reading configuration data /etc/ssh_config

debug1: /etc/ssh_config line 20: Applying options for *

debug2: ssh_connect: needpriv 0

debug1: Connecting to 123.10.98.22 [123.10.98.22] port 22.

debug1: Connection established.

debug1: identity file /.ssh/id_rsa type -1

debug1: identity file /.ssh/id_rsa-cert type -1

debug1: identity file /.ssh/id_dsa type -1

debug1: identity file /.ssh/id_dsa-cert type -1

debug1: Enabling compatibility mode for protocol 2.0

debug1: Local version string SSH-2.0-OpenSSH_6.2

ssh_exchange_identification: read: Connection reset by peer

2、检查是否配置了访问控制

cat /etc/hosts.allow


sshd:192.168.1.*:allow

sshd:all:deny


发现这里是不允许123.10.98.22 来登录的,所以需要添加一条规则:

sshd:192.168.1.*:allow

sshd:公司的出口IP:allow  ##这里的IP通过ip138.com可以查询。

sshd:all:deny