Linux 怎樣禁止root登錄
首先設置一個普通的登錄用戶
useradd testuser
passwd testpasswd
然後修改配置文件sshd_config
#LoginGraceTime 2m
#將PermitRootLogin 後面的值修改爲no
PermitRootLogin no
#StrictModes yes
#最大嘗試登錄次數
MaxAuthTries 3
#MaxSessions 10
最後重啓ssh服務
systemctl restart sshd.service
#登錄普通賬戶時,使用su或者sudo命令即可切換root賬戶