SSH 连接开始一直要求输入密码

SSH 连接开始一直要求输入密码

我曾经通过 Windows 11 配置文件进行 SSH 连接A到我管理的 Linode 服务器没有任何问题,而且无需输入密码。

现在我有了第二个 Windows 配置文件,所以我创建了一对新的 SSH 密钥并将公共密钥上传到服务器上,但是从这个配置文件中,它总是在身份验证结束时要求我输入密码!

结果如下:ssh -vvv -i C:\Users\B\.ssh\Linode [email protected]

OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug3: Failed to open file:C:/Users/B/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname xxx.xxx.xxx.xx is address
debug2: ssh_connect_direct
debug1: Connecting to xxx.xxx.xxx.xx [xxx.xxx.xxx.x] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\B\\.ssh\\Linode type 0
debug3: Failed to open file:C:/Users/B/.ssh/Linode-cert error:2
debug3: Failed to open file:C:/Users/B/.ssh/Linode-cert.pub error:2
debug1: identity file C:\\Users\\B\\.ssh\\Linode-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4p1 Ubuntu-6ubuntu2.1
debug1: match: OpenSSH_8.4p1 Ubuntu-6ubuntu2.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to xxx.xxx.xxx.xx:22 as 'root'
debug3: hostkeys_foreach: reading file "C:\\Users\\B/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file C:\\Users\\B/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from xxx.xxx.xxx.xx
debug3: Failed to open file:C:/Users/B/.ssh/known_hosts2 error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[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: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[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: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
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
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:zY4mA/Tcx73c+AGArY25oGx2HnSxys51gaKM6+LiHKg
debug3: hostkeys_foreach: reading file "C:\\Users\\B/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file C:\\Users\\B/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from xxx.xxx.xxx.xx
debug3: Failed to open file:C:/Users/B/.ssh/known_hosts2 error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug1: Host 'xxx.xxx.xxx.xx' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\B/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug3: unable to connect to pipe \\\\.\\pipe\\openssh-ssh-agent, error: 2
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\B\\.ssh\\Linode RSA SHA256:mUnox/XepW77wenzmEaARVLDhK06YWIiwI9TYkQ7psw explicit
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\B\\.ssh\\Linode RSA SHA256:mUnox/XepW77wenzmEaARVLDhK06YWIiwI9TYkQ7psw explicit
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
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
[email protected]'s password:

我一直在思考有关该主题的所有其他问题,但显然到目前为止没有任何效果......

编辑

这是服务器文件的片段/var/log/auth.log

Feb 26 01:03:56 localhost sshd[26813]: Failed password for invalid user analyn from 178.64.26.143 port 45688 ssh2
Feb 26 01:03:56 localhost sshd[26813]: Received disconnect from 178.64.26.143 port 45688:11: Bye Bye [preauth]
Feb 26 01:03:56 localhost sshd[26813]: Disconnected from invalid user analyn 178.64.26.143 port 45688 [preauth]
Feb 26 01:04:38 localhost sshd[26815]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=176.144.203.93  user=root
Feb 26 01:04:40 localhost sshd[26815]: Failed password for root from 176.144.203.93 port 60302 ssh2
Feb 26 01:04:45 localhost sshd[26815]: Accepted password for root from 176.144.203.93 port 60302 ssh2
Feb 26 01:04:45 localhost sshd[26815]: pam_unix(sshd:session): session opened for user root by (uid=0)
Feb 26 01:04:45 localhost systemd-logind[628]: New session 267 of user root.
Feb 26 01:04:45 localhost systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0)
Feb 26 01:04:49 localhost sshd[26815]: Received disconnect from 176.144.203.93 port 60302:11: disconnected by user
Feb 26 01:04:49 localhost sshd[26815]: Disconnected from user root 176.144.203.93 port 60302
Feb 26 01:04:49 localhost sshd[26815]: pam_unix(sshd:session): session closed for user root
Feb 26 01:04:49 localhost systemd-logind[628]: Session 267 logged out. Waiting for processes to exit.
Feb 26 01:04:49 localhost systemd-logind[628]: Removed session 267.
Feb 26 01:04:54 localhost sshd[26907]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=112.85.42.2  user=root
Feb 26 01:04:56 localhost sshd[26907]: Failed password for root from 112.85.42.2 port 35865 ssh2
Feb 26 01:04:59 localhost sshd[26909]: Accepted password for root from 176.144.203.93 port 60311 ssh2
Feb 26 01:04:59 localhost sshd[26909]: pam_unix(sshd:session): session opened for user root by (uid=0)
Feb 26 01:04:59 localhost systemd-logind[628]: New session 269 of user root.

相关内容