我知道选项
PasswordAuthentication yes
在CCD_ 1内部。是否可以按用户设置?我的目标是让一个拥有root权限的用户只使用公钥登录,而不是通过密码登录。另一个权限较低的用户可以使用密码登录,而不需要公钥。
sshd_config
包括选项Match
,它允许启动条件块
Match User user1
PasswordAuthentication yes
Match all
Other rules
您可以通过这种方式添加不同的条件规则
例如,只允许来自特定IP:的user1
Match Address 192.168.1.20
AllowUsers user1
修改sshd_config:后
systemctl restart sshd
systemctl status sshd
你可以测试你的设置。