所以我在 SSH 上遇到了一个奇怪的问题。我已经设置了我的 SSH 服务器以允许通过 SSH 密钥进行无密码登录。但是,当我尝试登录时,长时间(~天)后第一次登录时,它需要密码。如果我立即关闭连接并再次尝试 ssh-connect,它会接受 SSH 密钥。有谁知道如何获取它以便它始终接受 SSH 密钥?
这是我的 /etc/ssh/sshd_config
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime …
Run Code Online (Sandbox Code Playgroud) ssh ×1