限制从公共networkinglogin到公共密钥,但允许来自内部networking的密码

假设UserA被允许通过SSH从公共networking和私有networkinglogin到服务器。

是否有任何选项来限制密码login到私人networking,同时为世界其他地方执行公钥authentication?

我到目前为止在我的configuration

AllowUsers [email protected] [email protected] usera 

我怎样才能使用usera从[email protected]/24通过公共密钥或密码login,并强制从任何其他networking公用密钥loginusera?

做一些类似于以下工作的东西? 什么是确切的记法语法?

 # no password login from the public PasswordAuthentication no ChallengeResponseAuthentication no # allow password login from private network Match Users [email protected]/24 [email protected]/24 PasswordAuthentication yes 

感谢任何启示。

PS:这个设置的原因是在内部networking中启用密码login作为最后的手段,如果还有其他的失败。

你的configuration很接近。 我想你想要的是

 PubkeyAuthentication yes PasswordAuthentication yes AuthenticationMethods publickey Match Address 10.0.0.0/24 AuthenticationMethods publickey password 

您可以在man sshd_configfind详细信息。