linux給普通使用者增加ssh許可權

weixin_34378045發表於2017-07-14
//1,建立使用者 
useradd name

//2,修改密碼
passwd name

//3,修改ssh配置檔案,在最後一行新增AllowUsers name
vi /etc/ssh/sshd_config

//4,重啟ssh服務
service sshd restart

可以在/etc/ssh/sshd_config中增加AllowUsers:username(可以多個,空格分開)給普通使用者增加ssh許可權

也可以設定允許和拒絕ssh的使用者/使用者組: 
DenyUsers:username,DenyGroups:groupname

優先順序如下: 
DenyUsers:username 
AllowUsers:username 
DenyGroups:groupname 
AllowGroups:groupname

在給普通使用者設立ssh許可權後,即可將root ssh許可權禁用,增加安全性(也可以在sshd_config中將PermitRootLogin 選項修改為:PermitRootLogin no)

 

相關文章