将公钥从 Windows 复制到 Linux 服务器后,SSH 仍然询问密码

问题描述 投票:0回答:1

这是 ssh 时的日志

OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
debug1: Reading configuration data C:\\Users\\x/.ssh/config
debug1: C:\\Users\\x/.ssh/config line 1: Applying options for server-x
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to server-x [10.81.24.118] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\x/.ssh/id_rsa type 0
debug1: identity file C:\\Users\\x/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
debug1: compat_banner: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.7 pat OpenSSH* compat 0x04000000
debug1: Authenticating to server-x:22 as 'x'
debug1: load_hostkeys: fopen C:\\Users\\x/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
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: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: xxxxxxx
debug1: load_hostkeys: fopen C:\\Users\\x/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: Host server-x is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\x/.ssh/known_hosts:2
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\x/.ssh/id_rsa RSA SHA256:YIkF8FEzeVmk5i/FYJY0Z1IWYtXhRyjHnKOp9++Mmn4 explicit
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]>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: password,keyboard-interactive,hostbased
debug1: Next authentication method: keyboard-interactive

为什么debug信息上没有pubkey选项 debug1:可以继续的身份验证:密码、键盘交互、基于主机

我尝试更新 ssh 文件 .ssh/配置

主机服务器-x 身份文件~/.ssh/id_rsa

在服务器端,pub key保存在authorized_keys中。

ssh server public-key-encryption openssh
1个回答
0
投票

为什么在调试信息上,它没有 pubkey 选项 debug1: Authentications that can continue:password,keyboard-interactive,hostbased

该主机当前未启用公钥身份验证,否则您会在该列表中看到

publickey
。对该服务器具有 root 访问权限的人需要更新
/etc/ssh/sshd_config
,确保
PubkeyAuthentication
设置为
yes
(且未注释掉),然后重新启动 SSHD 守护进程。

© www.soinside.com 2019 - 2024. All rights reserved.