ホストへの接続がリモートホストによって終了しました。終了ステータス-1 [重複]

ホストへの接続がリモートホストによって終了しました。終了ステータス-1 [重複]

私は仮想Ubuntuサーバーを実行しており、通常は問題なく接続します。ところで、過去4日間に2回も受けました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

また、次のトピックを参照してください。サーバー障害、非常に便利な答えです。

関連情報