码迷,mamicode.com
首页 > 系统相关 > 详细

linux禁止root用户

时间:2017-09-01 15:45:42      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:linux禁止root用户

  1. 使用root账户登录系统,添加一个普通账户例如test,并为其设置密码

    useradd test

    passwd test

    技术分享

  2. 编辑配置文件/etc/ssh/sshd_config 修改PermitRootLogin 后面的yes 为 no ,并且去掉前面的注释符

    技术分享

  3. 最后重启sshd服务 /etc/init.d/ssh restart 或者service sshd restart,此时再用root用户登录,如果不能登陆则代表配置成功。如果需要使用root权限,可以使用su/sudo进行切换

    技术分享



本文出自 “李世龙” 博客,谢绝转载!

linux禁止root用户

标签:linux禁止root用户

原文地址:http://lwm666.blog.51cto.com/11811339/1961917

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!