AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / Perguntas / 787718
Accepted
whairst
whairst
Asked: 2024-12-06 09:30:57 +0800 CST2024-12-06 09:30:57 +0800 CST 2024-12-06 09:30:57 +0800 CST

O Debian 12 não aceita conexões ssh remotas

  • 772

Estou tentando configurar um servidor Debian 12 e não consigo fazer com que ele aceite conexões ssh da minha máquina Ubuntu 22.04 (ou de uma máquina Ubuntu mais antiga). Ele não pede uma senha; o comando ssh simplesmente termina imediatamente. Ssh para localhost e [Debian 12 IP] funcionam - solicita a senha, aceita e efetua login. Esta deve ser uma instalação próxima do estoque do Debian 12. Eu até tentei copiar o arquivo sshd_config de estoque da máquina Ubuntu 22.04 (que aceita conexões da máquina Debian) para a máquina Debian, mas sem sucesso.

Veja o que a máquina Ubuntu 22.04 apresenta quando tento uma conexão:

[localuser]@[localmachine]:~$ ssh -vvv [remoteuser]@192.168.2.9
OpenSSH_8.9p1 Ubuntu-3ubuntu0.10, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.2.9 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/[localuser]/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/[localuser]/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to 192.168.2.9 [192.168.2.9] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: Connection established.
debug1: identity file /home/[localuser]/.ssh/id_rsa type -1
debug1: identity file /home/[localuser]/.ssh/id_rsa-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_ecdsa type -1
debug1: identity file /home/[localuser]/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/[localuser]/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_ed25519 type -1
debug1: identity file /home/[localuser]/.ssh/id_ed25519-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_ed25519_sk type -1
debug1: identity file /home/[localuser]/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_xmss type -1
debug1: identity file /home/[localuser]/.ssh/id_xmss-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_dsa type -1
debug1: identity file /home/[localuser]/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10
kex_exchange_identification: read: Connection reset by peer
Connection reset by 192.168.2.9 port 22
[localuser]@[localmachine]:~$ 

Isto é o que a máquina Debian relata:

Dec 06 21:45:08 fafnir sshd[5704]: debug3: fd 5 is not O_NONBLOCK
Dec 06 21:45:08 fafnir sshd[5704]: debug1: Forked child 8037.
Dec 06 21:45:08 fafnir sshd[5704]: debug3: send_rexec_state: entering fd = 8 config len 3271
Dec 06 21:45:08 fafnir sshd[5704]: debug3: ssh_msg_send: type 0
Dec 06 21:45:08 fafnir sshd[5704]: debug3: send_rexec_state: done
Dec 06 21:45:08 fafnir sshd[8037]: debug3: oom_adjust_restore
Dec 06 21:45:08 fafnir sshd[8037]: debug1: Set /proc/self/oom_score_adj to 0
Dec 06 21:45:08 fafnir sshd[8037]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Dec 06 21:45:08 fafnir sshd[8037]: debug1: inetd sockets after dupping: 4, 4
Dec 06 21:45:08 fafnir sshd[8037]: debug1: getpeername failed: Transport endpoint is not connected
Dec 06 21:45:08 fafnir sshd[8037]: debug3: process_channel_timeouts: setting 0 timeouts
Dec 06 21:45:08 fafnir sshd[8037]: debug3: channel_clear_timeouts: clearing
Dec 06 21:45:08 fafnir sshd[8037]: debug1: ssh_remote_port failed

O arquivo de configuração atualmente é:


# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Include /etc/ssh/sshd_config.d/*.conf

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO
LogLevel Debug3

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
KbdInteractiveAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the KbdInteractiveAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and KbdInteractiveAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# override default of no subsystems
Subsystem   sftp    /usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server

Alguma ideia do que está errado? Note que não instalei nem configurei nenhum software de firewall, mas é possível que haja algo de estoque que eu não saiba.

debian
  • 1 1 respostas
  • 135 Views

1 respostas

  • Voted
  1. Best Answer
    whairst
    2024-12-11T20:49:05+08:002024-12-11T20:49:05+08:00

    Achei! A máscara de sub-rede da máquina Debian foi definida como 255.255.255.255 (CIDR 192.168.2.9/32), fazendo-a pensar que era a única máquina na sub-rede. Verifique o CIDR com "ip addr". Alterar a sub-rede para 255.255.255.0 (CIDR 192.168.2.9/24, como deveria ter sido) consertou o ssh. Como o ping faria o ssh funcionar, ainda não sei, mas foi uma solução alternativa utilizável.

    Como eu perdi isso nas minhas primeiras rodadas de buscas de DDG, eu também não sei. Mas aqui estão algumas coisas para tentar (além da sub-rede) para qualquer outra pessoa que tenha esse problema:

    18.04 - Não é possível fazer SSH no servidor até que eu tenha feito ping nele - Ask Ubuntu

    ssh - O servidor Ubuntu pode ser acessado somente após ping - Falha do servidor

    A conexão SSH com meu servidor doméstico SÓ funciona se o servidor estiver efetuando ping ao mesmo tempo: r/linux4noobs (reddit.com)

    [RESOLVIDO] ssh não consegue conectar, então eu ping, então ssh consegue, como pode ser? situação estranha... (linuxquestions.org)

    • 0

relate perguntas

  • Configuração do GRUB para reconhecer diferentes ambientes de desktop (instalações) da mesma distribuição Linux

  • astyle não altera a formatação do arquivo de origem

  • Recebendo e-mail em um novo Debian fresco

  • Debian Stretch: gnome-software segfault em libgs_plugin_systemd-updates.so

  • Como digitar ü no Pinyin IME?

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve