當你登錄一臺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