您的位置:首页 > 运维架构 > Linux

linux服务器防止任何人使用su命令成为root用户

2014-04-09 11:01 423 查看
linux服务器防止任何人使用su命令成为root用户
指定只有某个用户才可以使用su命令到root用户
实现方法:
1.vi /etc/pam.d/su
打开注释
# auth required pam_wheel.so use_uid
echo "SU_WHEEL_ONLY yes" >> /etc/login.defs
2.usermod -G 10 lndy //把lndy用户加入到wheel组
[root@localhost ~]# id landy
uid=500(lndy) gid=500(lndy) groups=500(lndy),10(wheel) context=root:system_r:unconfined_t:SystemLow-SystemHigh
[root@localhost ~]# id xxl
uid=501(xl) gid=501(xl) groups=501(xl) context=root:system_r:unconfined_t:SystemLow-SystemHigh
lndy用户可以su到root,而xl用户不可以su到root
[lndy@localhost ~]$ su -
Password:
[xl@localhost ~]$ su -
Password:
su: incorrect password

本文出自 “梦女孩” 博客,请务必保留此出处http://dreamgirl1314.blog.51cto.com/1159474/1392642
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: