无法通过 SSH 连接到 Ubuntu 服务器

无法通过 SSH 连接到 Ubuntu 服务器

我遇到了一个问题。我本来可以使用 ssh,但突然无法连接。我可以从本地访问服务器并登录,因此我确信我的密码是正确的。

以下是我解决该问题所采取的步骤。

  • 重置 sshd_config 文件
  • 重新安装 OpenSSH 服务器
  • 删除了 .ssh 目录
  • 从本地主机登录(user@localhost)

我还没有找到解决方案。

以下是尝试连接的输出。

ssh localhost
bsnell@localhost's password: 
Permission denied, please try again.
bsnell@localhost's password: 
Permission denied, please try again.
bsnell@localhost's password: 
bsnell@localhost: Permission denied (publickey,password).

编辑:我添加了 -v 参数以获得更清晰的

ssh -v localhost
OpenSSH_7.9p1 Ubuntu-10, OpenSSL 1.1.1b  26 Feb 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/bsnell/.ssh/id_rsa type 0
debug1: identity file /home/bsnell/.ssh/id_rsa-cert type -1
debug1: identity file /home/bsnell/.ssh/id_dsa type -1
debug1: identity file /home/bsnell/.ssh/id_dsa-cert type -1
debug1: identity file /home/bsnell/.ssh/id_ecdsa type -1
debug1: identity file /home/bsnell/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/bsnell/.ssh/id_ed25519 type -1
debug1: identity file /home/bsnell/.ssh/id_ed25519-cert type -1
debug1: identity file /home/bsnell/.ssh/id_xmss type -1
debug1: identity file /home/bsnell/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Ubuntu-10
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9p1 Ubuntu-10
debug1: match: OpenSSH_7.9p1 Ubuntu-10 pat OpenSSH* compat 0x04000000
debug1: Authenticating to localhost:22 as 'bsnell'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
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
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:+4zFWZU0KRVFbEqs+IREzcdoL3ZWVS8bE11R0nePYGI
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /home/bsnell/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /home/bsnell/.ssh/id_rsa RSA SHA256:X7z8sMVNq4lzPDe1qPtYpq32HNuHa/RgMT99iuoWhpM agent
debug1: Will attempt key: [email protected] RSA SHA256:TPTznPtVvqDDZ8TJVIoFhLS5ail9q69EOzpRRA+EQsg agent
debug1: Will attempt key: /home/bsnell/.ssh/id_dsa 
debug1: Will attempt key: /home/bsnell/.ssh/id_ecdsa 
debug1: Will attempt key: /home/bsnell/.ssh/id_ed25519 
debug1: Will attempt key: /home/bsnell/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/bsnell/.ssh/id_rsa RSA SHA256:X7z8sMVNq4lzPDe1qPtYpq32HNuHa/RgMT99iuoWhpM agent
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: [email protected] RSA SHA256:TPTznPtVvqDDZ8TJVIoFhLS5ail9q69EOzpRRA+EQsg agent
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/bsnell/.ssh/id_dsa
debug1: Trying private key: /home/bsnell/.ssh/id_ecdsa
debug1: Trying private key: /home/bsnell/.ssh/id_ed25519
debug1: Trying private key: /home/bsnell/.ssh/id_xmss
debug1: Next authentication method: password
bsnell@localhost's password: 
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
bsnell@localhost's password: 
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
bsnell@localhost's password: 
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
bsnell@localhost: Permission denied (publickey,password).

相关内容