主机接受 SSH 密钥但客户端断开连接

Pre*_*leo 9 ssh private-key

你好,

我在 Fedora 23 安装后遇到了 SSH 问题。

当我不想使用私钥连接到我的远程主机时,我的主机会找到密钥:

debug1: matching key found: file /home/theo/.ssh/authorized_keys, line 1 RSA {REDACTED}
debug1: restore_uid: 0/0
Postponed publickey for theo from {REDACTED} port 60351 ssh2 [preauth]
Connection closed by {REDACTED} [preauth]
debug1: do_cleanup [preauth]
debug1: monitor_read_log: child log fd closed
Run Code Online (Sandbox Code Playgroud)

但正如你看到我的客户自己断开连接

debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/tbouge/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 1047
debug2: input_userauth_pk_ok: fp SHA256:{REDACTED}
debug3: sign_and_send_pubkey: RSA SHA256:{REDACTED}
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)

我可以使用相同的私钥在 Windows 上使用 Putty 连接到我的主机,并且我可以使用不同的私钥连接到我的手机。

你有什么主意吗 ?

/etc/ssh/ssh_conf

Host *
        GSSAPIAuthentication yes
# If this option is set to yes then remote X11 clients will have full access
# to the original X11 display. As virtually no X11 client supports the untrusted
# mode correctly we set this to yes.
        ForwardX11Trusted yes
# Send locale-related environment variables
        SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
        SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
        SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
        SendEnv XMODIFIERS
Run Code Online (Sandbox Code Playgroud)

谢谢

编辑:我可以用密码连接

小智 3

您的 ssh 文件的权限是否正确?

.ssh 文件夹 --> 700

公钥 --> 644

私钥 --> 600

还要检查用户和组