sshd 可以使用密钥和密码对每个传入连接进行身份验证吗?

ths*_*ton 2 ssh password authentication keys

我想配置sshd为要求连接使用密钥和密码进行身份验证。

我还没有考虑使用 PAM 或其他外部身份验证方法,但目前我的猜测(基于sshd_config(5)这是不可能的。证明我错了。拜托?

Mic*_*ael 5

如果您使用的是 openssh,我不相信您可以做到这一点。还有其他 SSH2 守护进程允许扩展 SSH2 指令,为您提供一个名为“RequiredAuthentications”和“AllowedAuthentications”的指令;两者都是逗号分隔的列表。您可以在以下位置查看漂亮的兼容性图表:

http://hell.org.ua/Docs/oreilly/tcpip2/ssh/ch05_05.htm

如果这是您的要求,您应该更改您的 ssh 守护程序。配置将是:

AllowedAuthentications password,publickey
RequiredAuthentications password,publickey
Run Code Online (Sandbox Code Playgroud)

干杯