发布于 4年前

SSH 禁止特定用户使用密码登录

SSH禁止特定用户使用密码登录可以在/etc/ssh/sshd_config添加Match配置过滤指定的用户。

按用户过滤

Match User user1,user2,user3,user4
    PasswordAuthentication no

按组过滤

Match Group group1
    PasswordAuthentication no

使用叹号(!)取非过滤

Match User !root
    PasswordAuthentication no

注意:Match是引入了一个条件块,如果满足Match行指定的条件,那么随后的指令将会覆盖全局配置的指令。Match条件块的结束标识为下一个Match指令或者是文件结束。

ssh
©2020 edoou.com   京ICP备16001874号-3