能否對Linux服務器實現這樣的登錄需求:普通用戶可以使用密碼驗證登錄;一個特殊用戶必須采用ssh密鑰文件進行登錄。我在sshd_config配置文件中發現PasswordAuthentication yes或PubkeyAuthentication yes都是針對所有用戶的
1 回答

小唯快跑啊
TA貢獻1863條經驗 獲得超2個贊
在sshd_config
末尾添加:
Match User username PasswordAuthentication no
注意為什么是在末尾加?是因為 Match
語法一直匹配到下一個Match
或者文件末尾
這里面如果有其他配置的話 都只針對此Match生效
如果是針對一個組
Match Group groupname PasswordAuthentication no
如果是反過來,只有某用戶可以使用密碼登錄,其他用戶都不可以
Match User !username PasswordAuthentication no
- 1 回答
- 0 關注
- 723 瀏覽
添加回答
舉報
0/150
提交
取消