root用户限制登陆

一、root账户不能使用密码只能使用密钥远程登陆


打开sshd配置文件


vim /etc/ssh/sshd_config  


在最后面增加一行 :


PermitRootLogin without-password


保存配置文件  :wq


后重启sshd服务 service  sshd  restart


二、root账户不允许远程登陆


只允许普通账户登陆Linux,而不允许root账户登陆,


而普通账户登陆后,然后再su 到root下是可以的。打开sshd的配置文件 

vim /etc/ssh/sshd_config  加入一行:


  1. PermitRootLogin no


重启sshd服务: service  sshd restart



你可能感兴趣的:(root,登陆,用户限制)