Conexão ao host fechado pelo host remoto. Sair do status -1 [duplicado]

2

eu corro um servidor virtual Ubuntu com eu normalmente não tenho problemas para se conectar. No entanto, nos últimos 4 dias eu tenho duas vezes connection closed by remote host . Eu tenho várias contas, mas com cada um eu tenho o mesmo resultado. Após a reinicialização, consegui fazer o login novamente.

Isto é o que eu recebo quando o login não é possível

 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

Para solucionar meu problema

  • segui este postar e abrir

    $(which sshd) -Ddp 10222
    

    e eu consegui fazer o login com

    ssh -p 10222 user@host
    
  • Não estou usando hosts.allow ou hosts.deny .

  • Eu tenho uma conta que não possui uma chave ssh associada. Mas, mesmo com a digitação da senha correta, recebo a mesma mensagem de erro.

  • Em /etc/ssh/sshd_config

     #MaxStartups #is not used
    

Quais outras etapas posso fazer para garantir que o ssh seja configurado corretamente?

    
por theDrifter 20.12.2016 / 13:09

1 resposta

1

"Esta mensagem significa que o cliente obteve uma conexão TCP com o servidor, mas o servidor a fechou imediatamente antes que o protocolo SSH pudesse ser iniciado (a rotina ssh_exchange_identification implementa a troca de string de versão, a etapa inicial do protocolo). Isso geralmente acontece devido a uma configuração de libwrap que proíbe a conexão. Verifique o log do servidor; Se este for o problema, você verá mensagens como estas:

SSH1, OpenSSH sshd1[15092]: refused connect from 192.168.10.1
SSH2 sshd2[15085]: Denied connection from by 192.168.10.1 tcp wrappers.

Se você compilou o servidor SSH com libwrap (TCP-wrappers) support, verifique se as regras nos arquivos /etc/hosts.{allow,deny} no host do servidor permitem a conexão com o daemon SSH. Uma entrada como essa, por exemplo, permitirá conexões ao sshd de qualquer endereço de origem:

sshd sshd1 sshd2 : ALL : ALLOW

O nome à esquerda deve ser o valor argv[0] do daemon em execução, portanto, se você chamou sshd com outro nome, precisará usá-lo. Além disso, as regras dependem da ordem, de modo que a regra que acabamos de dar pode não funcionar, dependendo das outras regras e de seu posicionamento relativo. Veja a página hosts_access(5) man para detalhes sobre a sintaxe e semântica da regra libwrap . "

Veja: Perguntas frequentes do SSH

Além disso, por favor, veja esta entrada em serverfault , respostas muito úteis.

    
por 20.12.2016 / 16:08