Centos禁用root从ssh登录

Linux的默认管理员名即是root,只需要知道ROOT密码即可直接登录SSH。禁止Root从SSH直接登录可以提高服务器安全性。

修改/etc/ssh/sshd_config文件

[root@localhost ~]# vi /etc/ssh/sshd_config
...
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PermitRootLogin yes的#去掉把yes改为no
重启ssh服务生效

[root@localhost ~]# systemctl restart sshd
添加新评论