ssh_exchange_identification: Connection closed by remote host

(Ssh exchange identification에서 넘어옴)
SSH 접속 불가
ssh_exchange_identification: Connection closed by remote host
외부 호스트에 의해 접속이 종료되었습니다.

1 문제상황[ | ]

아래와 같은 메시지가 나오면서 SSH 접속이 되지 않는다.

[root@localhost ~]# ssh example.com
ssh_exchange_identification: Connection closed by remote host
[root@localhost ~]# ssh 135.79.246.80
ssh_exchange_identification: Connection closed by remote host
→ 서버측에서 22포트를 LISTEN중이지만, 접속을 거부함

2 확인[ | ]

[root@localhost ~]# ssh 135.79.246.80 -v
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config  
debug1: /etc/ssh/ssh_config line 19: Applying options for *  
debug2: ssh_connect: needpriv 0  
debug1: Connecting to 135.79.246.80 [135.79.246.80] port 22.  
debug1: Connection established.  
debug1: identity file /home/vivek/.ssh/id_rsa type -1  
debug1: identity file /home/vivek/.ssh/id_rsa-cert type -1  
debug1: identity file /home/vivek/.ssh/id_dsa type -1  
debug1: identity file /home/vivek/.ssh/id_dsa-cert type -1  
debug1: identity file /home/vivek/.ssh/id_ecdsa type -1  
debug1: identity file /home/vivek/.ssh/id_ecdsa-cert type -1  
debug1: identity file /home/vivek/.ssh/id_ed25519 type -1  
debug1: identity file /home/vivek/.ssh/id_ed25519-cert type -1  
debug1: Enabling compatibility mode for protocol 2.0  
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4  
ssh_exchange_identification: Connection closed by remote host

3 hosts.deny[ | ]

평소 접속하는 PC에서 접속하니 잘 된다...

  • SSH 보안 강화 때문이었다.
[root@zetawiki ~]# cat /etc/hosts.deny | grep -v ^#
sshd: ALL
[root@zetawiki ~]# cat /etc/hosts.allow | grep -v ^#
sshd: 135.79.246.80, 123.456.
→ 모든 IP에서의 ssh 접속을 제한
→ 단, 지정한 IP대역 135.79.246.80과 123.456.x.x은 제외
hosts.allow에 접속지 IP를 추가해주니 sshd 재시작 없이 바로 접속된다.

4 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}