저는 가상 우분투 서버를 실행하고 있으며 일반적으로 문제 없이 연결합니다. 그런데 지난 4일 동안 두 번이나 받았어요 connection closed by remote host
. 여러 계정이 있지만 각 계정에서 동일한 결과가 나타납니다. 재부팅 후 다시 로그인할 수 있었습니다.
로그인이 안 될 때 이런 메시지가 뜹니다
ssh -vvv user@host_name
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /home/user/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "host_name" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to host_name [IP.IP.IP.IP] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 pat OpenSSH_6.6.1* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to host_name:22 as 'user'
debug3: hostkeys_foreach: reading file "/home/user/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/user/.ssh/known_hosts:23
debug3: load_hostkeys: loaded 1 keys from host_name
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],ecdsa-sha2-nistp521-c
[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,dif
fie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected]
m,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],ssh-ed25519,rsa-sha2-512,r
sa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-c
bc,aes256-cbc,3des-cbc
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-c
bc,aes256-cbc,3des-cbc
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],hmac-sha1-etm@openssh.
com,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],hmac-sha1-etm@openssh.
com,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,dif
fie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: host key algorithms: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected]
om,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected]
om,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],h
[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,umac-64@openss
h.com,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],h
[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,umac-64@openss
h.com,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:eJMfyQRvAyYtV7qR3eZHoHJv4um5NlkZ6lqOM5+3/x8
debug3: hostkeys_foreach: reading file "/home/user/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/user/.ssh/known_hosts:23
debug3: load_hostkeys: loaded 1 keys from host
debug3: hostkeys_foreach: reading file "/home/user/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/user/.ssh/known_hosts:24
debug3: load_hostkeys: loaded 1 keys from IP.IP.IP.IP
debug1: Host 'host' is known and matches the ECDSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:23
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug2: key: user@local (0x5587cbcb1630), agent
debug2: key: user@local (0x5587cbcaf4f0), agent
debug2: key: user@local (0x5587cbcaf560), agent
debug2: key: user@local (0x5587cbcb1260), agent
debug2: key: user@local (0x5587cbcb12b0), agent
debug2: key: /home/user/.ssh/id_rsa ((nil))
debug2: key: /home/user/.ssh/id_dsa ((nil))
debug2: key: /home/user/.ssh/id_ecdsa ((nil))
debug2: key: /home/user/.ssh/id_ed25519 ((nil))
debug3: send packet: type 5
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: user@local
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: user@local
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: user@local
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug2: input_userauth_pk_ok: fp SHA256:sc7ESM4WTnxwcB1WLlNt0P34/j0U2c/SbDL2d9re7VA
debug3: sign_and_send_pubkey: RSA SHA256:sc7ESM4WTnxwcB1WLlNt0P34/j0U2c/SbDL2d9re7VA
debug3: send packet: type 50
debug3: receive packet: type 53
debug3: input_userauth_banner
System is booting up.
debug1: Authentication succeeded (publickey).
Authenticated to host ([IP.IP.IP.IP]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t3 r-1 i0/0 o0/0 fd 5/6 cc -1)
Connection to host closed by remote host.
Connection to host closed.
Transferred: sent 4028, received 2672 bytes, in 0.0 seconds
Bytes per second: sent 45293985.3, received 30046059.8
debug1: Exit status -1
내 문제를 해결해줘
나는 팔로우한다이것게시 및 공개
$(which sshd) -Ddp 10222
로그인할 수 있어요
ssh -p 10222 user@host
나는
hosts.allow
또는 을 사용하지 않습니다hosts.deny
.SSH 키가 연결되지 않은 계정이 있습니다. 하지만 올바른 비밀번호를 입력했는데도 같은 오류 메시지가 나타납니다.
존재하다
/etc/ssh/sshd_config
#MaxStartups #is not used
SSH가 올바르게 구성되었는지 확인하기 위해 수행할 수 있는 다른 단계는 무엇입니까?
답변1
"이 메시지는 클라이언트가 서버와 TCP 연결을 설정했지만 SSH 프로토콜이 시작되기 직전에 서버가 연결을 닫았음을 의미합니다(ssh_exchange_identification 루틴은 프로토콜의 초기 단계인 버전 문자열 교환을 구현합니다). 이는 일반적으로 서버 로그 확인으로 인해 발생하는 libwrap
문제인 경우 다음과 같은 메시지가 표시됩니다.
SSH1, OpenSSH sshd1[15092]: refused connect from 192.168.10.1
SSH2 sshd2[15085]: Denied connection from by 192.168.10.1 tcp wrappers.
SSH 서버를 지원하도록 컴파일한 경우 libwrap (TCP-wrappers)
서버 호스트의 파일에서 SSH 데몬에 대한 연결을 허용하는 규칙을 확인하세요. /etc/hosts.{allow,deny}
예를 들어, 이러한 항목은 모든 소스 주소에서 sshd에 대한 연결을 허용합니다.
sshd sshd1 sshd2 : ALL : ALLOW
왼쪽의 이름은 argv[0]
실행중인 데몬의 값이어야 하므로, 다른 이름으로 sshd를 호출할 경우 해당 이름을 사용해야 합니다. 또한 규칙은 순서에 따라 달라지므로 방금 제공된 규칙은 다른 규칙 및 상대적 위치에 따라 작동하지 않을 수 있습니다. 규칙 구문 및 의미 hosts_access(5)
에 대한 libwrap
자세한 내용은 매뉴얼 페이지를 참조하십시오 . "
바라보다: SSH FAQ
또한 다음 항목을 참조하세요.서버 장애, 매우 유용한 답변입니다.