我如何设置OpenSSH每用户身份validation方法?

我希望能够有一组用户使用公共密钥身份validation和其他用户进行身份validation。

这在Linux上的OpenSSH可能吗? 如果是这样,我该怎么办呢?

通过/etc/ssh/sshd_config查看后,似乎只能启用密钥身份validation或使用PAM。

Match指令(在man sshd_config描述)允许在sshd服务器的一个实例中为不同的用户指定不同的authentication方法。 作为枚举个人用户和群组的奖励,还允许通过通配符select它们。

 Match Group wheel # for users from group wheel: PubkeyAuthentication Match Group !wheel,* # for other users: PasswordAuthentication # caution: don't add directives here - they will be caught by "Match" block # (end of file /etc/ssh/sshd_config) 

可以运行两个不同的OpenSSH实例。 一个用于PasswordAuthentication ,另一个用于PubkeyAuthentication (每个绑定到不同的地址)。 然后AllowGroupsconfiguration指令将被用来控制哪些组可以使用哪个服务器。

但是我可能会误解这个问题,因为你会说“这是PAM或PublicKey身份validation”。 两者都可以同时启用。 它们不是相互排斥的。