wheel 组的概念安全
wheel 组的概念继承自 UNIX。当服务器须要进行一些平常系统管理员没法执行的高级维护时,每每就要用到 root 权限;而“wheel” 组就是一个包含这些特殊权限的用户池;也就是说,若是你不是“wheel”组的成员,就没法取得 root 权限进行一些特权的操做;服务器
为何须要 wheel 组?
一般在UNIX下,即便咱们是系统的管理员,也不推荐用 root 用户登陆来进行系统管理。通常状况下用普通用户登陆,在须要 root 权限执行一些操做时,再 su 登陆成为 root 用户。可是,任何人只要知道了 root 的密码,就均可以经过 su 命令来登陆为 root 用户——这无疑为系统带来了安全隐患。因此,将普通用户加入到 wheel 组,被加入的这个普通用户就成了管理员组内的用户,但若是不对一些相关的配置文件进行配置,这个管理员组内的用户与普通用户也没什么区别——就像警察下班后,没有带枪、穿这便衣和普通人(用户)同样,虽然他的的确确是警察。app
如何把用户加入 wheel 组?ui
前面说了,除了 root 用户,只有 wheel 组的成员有特权执行高级操做,那么怎么把用户提高成为 wheel 用户组成员呢?this
可使用 vigr 来编辑 /etc/group 文件,将新的用户名追加到 wheel 组的末尾,就像这样:spa
wheel::10:root,kc继承
对于服务器来讲,咱们但愿的是剥夺被加入到 wheel 组用户之外的普通用户经过 su 命令来登陆为 root 的机会(即只有属于 wheel 组的用户才能够用 su 登陆为 root)。这样就进一步加强了系统的安全性。具体步骤以下:
1)修改 /etc/pam.d/su 文件,找到“#auth required /lib/security/$ISA/pam_wheel.so use_uid ”这一行,将行首的“#”去掉。ip
2)修改 /etc/login.defs 文件,在最后一行增长“SU_WHEEL_ONLY yes”语句。ci
而后,用“usermod -G wheel 用户名”将一个用户添加到 wheel 组中;
而后,用刚刚被添加到 wheel 组的用户登陆,并执行 su 命令登陆为 root 用户;这时,输入了正确的 root 密码就能够正常的登陆为 root 用户了。it
知识延展:staff 和 wheel 的区别
下面是一段关于staff 和 wheel 区别的解释,原文来自http://forums.macnn.com/90/mac-os-x/108958/group-permissions-wheel-vs-staff-whats/
The wheel group is used to control those people that can su to the root user (though this is made irrelevant by the sudo command).
All of the users on your system will be in the staff group, so by changing group ownership of files to staff the group permissions will apply to all users. All of the administrators on your system will be in the wheel group, so by changing group ownership of the files to wheel group permissions will apply to all of the administrators, global permissions will apply to any other users. My advice is that, except for files that you have created, you leave the group ownership and permissions alone. Unix is very particular about file ownership and permissions in certain areas and changing them only leads to trouble. |
我是这么理解的,wheel 是一个特殊的可使用 su 切换到 root 的用户组;而 staff 组是全部普通用户的集合。 |