免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8145 | 回复: 4
打印 上一主题 下一主题

如何设置禁止root本地登录 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-02-27 20:56 |只看该作者 |倒序浏览
这边有个古怪的需求,设置linux不运行root直接登录
注意,是本地的控制台的登录不是ssh等远程登录
我这边的系统是centos6MINI版的
/etc/pam.d/
如下
-rw-r--r--. 1 root root 192 Dec  8 04:56 chfn
-rw-r--r--. 1 root root 192 Dec  8 04:56 chsh
-rw-r--r--. 1 root root 232 Dec  8 03:20 config-util
-rw-r--r--. 1 root root  71 Feb 22 19:52 cvs
lrwxrwxrwx. 1 root root  19 Feb 24 18:35 fingerprint-auth -> fingerprint-auth-ac
-rw-r--r--. 1 root root 659 Feb 24 18:35 fingerprint-auth-ac
-rw-r--r--. 1 root root 728 Dec  8 04:56 login
-rw-r--r--. 1 root root 172 Dec  8 09:02 newrole
-rw-r--r--. 1 root root 154 Dec  8 03:20 other
-rw-r--r--. 1 root root 146 Aug 22  2010 passwd
lrwxrwxrwx. 1 root root  16 Feb 24 18:35 password-auth -> password-auth-ac
-rw-r--r--. 1 root root 896 Feb 24 18:35 password-auth-ac
-rw-r--r--. 1 root root 155 Jun 25  2011 polkit-1
-rw-r--r--. 1 root root 613 Dec  8 04:56 remote
-rw-r--r--. 1 root root 167 Dec  8 09:02 run_init
-rw-r--r--. 1 root root 143 Feb 14  2007 runuser
-rw-r--r--. 1 root root 105 Feb 14  2007 runuser-l
lrwxrwxrwx. 1 root root  17 Feb 24 18:35 smartcard-auth -> smartcard-auth-ac
-rw-r--r--. 1 root root 711 Feb 24 18:35 smartcard-auth-ac
-rw-r--r--. 1 root root 575 Dec  8 04:25 sshd
-rw-r--r--. 1 root root 341 Dec  8 04:25 ssh-keycat
-rw-r--r--. 1 root root 487 Feb 14  2007 su
-rw-r--r--. 1 root root 137 Feb 14  2007 su-l
lrwxrwxrwx. 1 root root  14 Feb 24 18:35 system-auth -> system-auth-ac
-rw-r--r--. 1 root root 896 Feb 24 18:35 system-auth-ac

论坛徽章:
0
2 [报告]
发表于 2012-02-27 21:40 |只看该作者

  1. [root@localhost ~]# cat /etc/securetty
  2. console
  3. vc/1
  4. vc/2
  5. vc/3
  6. vc/4
  7. vc/5
  8. vc/6
  9. vc/7
  10. vc/8
  11. vc/9
  12. vc/10
  13. vc/11
  14. #tty1
  15. #tty2
  16. #tty3
  17. #tty4
  18. #tty5
  19. #tty6
  20. #tty7
  21. #tty8
  22. #tty9
  23. #tty10
  24. #tty11
  25. [root@localhost ~]#


复制代码

论坛徽章:
0
3 [报告]
发表于 2012-02-27 21:45 |只看该作者
不知改 passwd  中 shell  为 nologin行不

论坛徽章:
4
CU大牛徽章
日期:2013-03-13 15:29:07CU大牛徽章
日期:2013-03-13 15:29:49CU大牛徽章
日期:2013-03-13 15:30:192015年迎新春徽章
日期:2015-03-04 09:57:09
4 [报告]
发表于 2012-02-27 23:10 |只看该作者
本地的话,我认为没有必要这样做啊,何必呢,又没有sudo。

论坛徽章:
0
5 [报告]
发表于 2012-02-28 15:33 |只看该作者
谢谢 弟兄们了
auth required pam_succeed_if.so user != root quiet
放到文件
/etc/pam.d/login
第一行就可以了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP