无法通过SSH连接到远程服务器。错误:ssh_exchange_identification:读取:由对等方重置连接

时间:2018-05-31 06:10:05

标签: linux ssh centos

I have changed the file sshd_config under /etc/ssh/ directory. I have also changed the permission of files under /etc/ssh/ directory. Now when i am trying to execute

ssh username@remoteserverIP -vv 
I am getting below logs.

OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug2: resolving "server IP" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to server IP [server IP] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
ssh_exchange_identification: read: Connection reset by peer

我无权访问root用户。我也尝试过腻子。 Putty给出了以下错误。

服务器意外关闭网络连接

1 个答案:

答案 0 :(得分:0)

或许/etc/hosts.deny包含" ALL:"的条目或" ssh:"阻止你连接。

添加" ssh: ALL"或" ssh: x.x.x.x" (将x.x.x.x替换为您的IP)到/etc/hosts.allow可以解决此问题。