84669 personnes étudient
152542 personnes étudient
20005 personnes étudient
5487 personnes étudient
7821 personnes étudient
359900 personnes étudient
3350 personnes étudient
180660 personnes étudient
48569 personnes étudient
18603 personnes étudient
40936 personnes étudient
1549 personnes étudient
1183 personnes étudient
32909 personnes étudient
能否对Linux服务器实现这样的登录需求:普通用户可以使用密码验证登录;一个特殊用户必须采用ssh密钥文件进行登录。 我在sshd_config配置文件中发现PasswordAuthentication yes或PubkeyAuthentication yes都是针对所有用户的
sshd_config
PasswordAuthentication yes
PubkeyAuthentication yes
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
在sshd_config末尾添加:
Match User username PasswordAuthentication no
注意为什么是在末尾加?是因为 Match语法一直匹配到下一个Match 或者文件末尾 这里面如果有其他配置的话 都只针对此Match生效
Match
下一个Match
文件末尾
如果是针对一个组
Match Group groupname PasswordAuthentication no
如果是反过来,只有某用户可以使用密码登录,其他用户都不可以
Match User !username PasswordAuthentication no
在
sshd_config
末尾添加:注意为什么是在末尾加?是因为
Match
语法一直匹配到下一个Match
或者文件末尾
这里面如果有其他配置的话 都只针对此Match生效
如果是针对一个组
如果是反过来,只有某用户可以使用密码登录,其他用户都不可以