ssh - Conexão redefinida pela porta [ip] 22 (Ubuntu 16.04)

0

Eu tenho ssh'ing para este computador (também Ubuntu 16) por meses, hoje não está funcionando.

executando ssh -v [ip] yields

OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.0.211 [192.168.0.211] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
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.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.0.211:22 as 'user'
debug1: SSH2_MSG_KEXINIT sent
Connection reset by 192.168.0.211 port 22

Executando nmap -v [ip] yields

Starting Nmap 7.01 ( https://nmap.org ) at 2018-09-06 08:44 MDT
Initiating Ping Scan at 08:44
Scanning 192.168.0.211 [2 ports]
Completed Ping Scan at 08:44, 0.09s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 08:44
Completed Parallel DNS resolution of 1 host. at 08:44, 0.03s elapsed
Initiating Connect Scan at 08:44
Scanning 192.168.0.211 [1000 ports]
Discovered open port 22/tcp on 192.168.0.211
Discovered open port 80/tcp on 192.168.0.211
Completed Connect Scan at 08:44, 0.49s elapsed (1000 total ports)
Nmap scan report for 192.168.0.211
Host is up (0.012s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http
Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 0.63 seconds

Eu posso ssh do destino para o meu computador muito bem.

O IP não está dentro de /etc/hosts.deny

    
por star_trac 06.09.2018 / 16:48

1 resposta

0

Colocando isso aqui para evitar algumas dores de cabeça futuras para pessoas que pesquisam o assunto. Eu tive dificuldade em encontrar uma boa solução. Eu não sabia que havia um arquivo de log para coisas relacionadas ao ssh.

Examinar o arquivo de log no servidor ( /var/log/auth.log ) revelou que as permissões para várias chaves em /etc/ssh/ foram definidas como 755, o que é muito aberto. Somente o usuário deve ter perms para ver estes. Então, usar chmod 400 em todas as chaves afetadas resolveu meu problema.

    
por 07.09.2018 / 16:10