歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Linux中的wheel組和staff組

Linux中的wheel組和staff組

日期:2017/3/1 14:02:07   编辑:關於Linux
Linux中的wheel組和staff組 wheel 組的概念   wheel 組的概念繼承自 UNIX。當服務器需要進行一些日常系統管理員無法執行的高級維護時,往往就要用到 root 權限;而“wheel” 組就是一個包含這些特殊權限的用戶池;也就是說,如果你不是“wheel”組的成員,就無法取得 root 權限進行一些特權的操作; 為什麼需要 wheel 組?   通常在UNIX下,即使我們是系統的管理員,也不推薦用 root 用戶登錄來進行系統管理。一般情況下用普通用戶登錄,在需要 root 權限執行一些操作時,再 su 登錄成為 root 用戶。但是,任何人只要知道了 root 的密碼,就都可以通過 su 命令來登錄為 root 用戶——這無疑為系統帶來了安全隱患。所以,將普通用戶加入到 wheel 組,被加入的這個普通用戶就成了管理員組內的用戶,但如果不對一些相關的配置文件進行配置,這個管理員組內的用戶與普通用戶也沒什麼區別——就像警察下班後,沒有帶槍、穿這便衣和普通人(用戶)一樣,雖然他的的確確是警察。 如何把用戶加入 wheel 組?   前面說了,除了 root 用戶,只有 wheel 組的成員有特權執行高級操作,那麼怎麼把用戶提升成為 wheel 用戶組成員呢?   可以使用 vigr 來編輯 /etc/group 文件,將新的用戶名追加到 wheel 組的末尾,就像這樣:   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 ”這一行,將行首的“#”去掉。 2)修改 /etc/login.defs 文件,在最後一行增加“SU_WHEEL_ONLY yes”語句。 然後,用“usermod -G wheel 用戶名”將一個用戶添加到 wheel 組中; 然後,用剛剛被添加到 wheel 組的用戶登錄,並執行 su 命令登錄為 root 用戶;這時,輸入了正確的 root 密碼就可以正常的登錄為 root 用戶了。 知識延展:staff 和 wheel 的區別 下面是一段關於staff 和 wheel 區別的解釋,原文來自 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 組是所有普通用戶的集合。
Copyright © Linux教程網 All Rights Reserved