FlossDoc: 请协力 GPLv3 的中文翻译工作。

File:/etc/group

FlossDoc,自由中文開源知識庫

< File: | etc
Jump to: navigation, search

檔案 /etc/group 記錄了 Unix/Linux 系統上每一個使用者群組 (user group) 的資訊。由於存放了很多程式需要的群組資訊如 GID 、群組成員等,它的檔案權限 (file mode) 一般會設為所有使用者可以讀取 (rw-r--r--) 。

其格式是很簡單的文字檔,一般可以直接使用任何文字編輯器在此檔案增加一行來為系統新增新的群組。當然大部份 Unix/Linux 都會提供更佳的工具更安全地修此檔案來增減群組。

目录

結構與內容

group 檔案中的每一列記錄了系統每一個群組的資料。每一列的格式如下:

groupname:encrypted-password:GID:comment:member-list
  1. 群組名稱 (Group name)
  2. 已加密的密碼 (Encrypted password)
  3. 群組識別編號 (GID, Group identification number)
  4. 成員清單 (Member list)

標準群組

和使用者一樣,大部份 Unix/Linux 都會建立一些群組列如 bin、daemon、tty、mail、lp 和 games 作系統之用,這些群組多用作控制對硬體裝置或系統檔案的存取。而一般系統都會預留開體一部份的 GID 給這些系統群組 (system group),把它們和一般使用者群組分開。例如 Debian 和 Ubuntu 系統的 GID 0 至 999 都預留作系統群組之用,GID 1000 開始才是第一個使用者群組。而 Fedora、RHEL 和 CentOS 等則只用 GID 0 至 499 作系統群組之用。基過多年的發展,很多固有的系統群組已沒有直正被使用,但基於歷史和兼容原因,現時仍被保留下來。

群組 root、system,wheel 或 sys 在不少 Unix/Linux 系統會被編排為 GID 0。和超級使用者 root (UID 0) 差不多,這類群組一般都有很高的權力,而很多系統檔案都屬於此群組。[1] 在包括 Debian、Ubuntu、Fedora、RHEL 和 CentOS 等 GNU/Linux 上,群組 root 被編排為 GID 0,而 sys 則為 GID 3。wheel 在 Red Hat 系 GNU/Linux 被編排為 GID 10,Debian 系 GNU/Linux 則沒有此群組。

群組 users (一般為 GID 100) 一般用作一般使用者的預設群組。

Debian/Ubuntu 群組

在 Debian/Ubuntu 系統中,群組編號 0 至 99 屬全域分配系統群組。由 Debian 計劃分配,在所有 Debian 系統中每一個群組編號對應相同的群組。 [2] [3]

  • daemon (GID 1 ) - 一些需要寫入一些檔案的服務程式 (daemon) 會編入此群組,現時主要為 portmap 和 atd 等系統服務和其需要寫入的檔案使用。
  • bin (GID 2 ) -
  • sys (GID 3 ) -
  • adm (GID 4 ) -
  • tty (GID 5 ) -
  • disk (GID 6 ) - 群組成員可以存取或掛載各儲存裝置。
  • lp (GID 7 ) - 列印系統使用的群組。
  • mail (GID 8 ) - 電子郵件系統使用的群組
  • news (GID 9 ) - 新聞組軟件使用的群組
  • uucp (GID 10 ) - UUCP 系統使用的群組
  • man (GID 12 ) -
  • proxy (GID 13 ) -
  • kmem (GID 15 ) -
  • dialout (GID 20 ) - 群組成員可以存取各串列埠 (serial port)
  • fax (GID 21 ) -
  • voice (GID 22 ) -
  • cdrom (GID 24 ) -
  • floppy (GID 25 ) -
  • tape (GID 26 ) -
  • sudo (GID 27 ) -
  • audio (GID 29 ) -
  • dip (GID 30 ) -
  • www-data (GID 33 ) -
  • backup (GID 34 ) -
  • operator (GID 37 ) -
  • list (GID 38 ) -
  • irc (GID 39 ) -
  • src (GID 40 ) -
  • gnats (GID 41 ) -
  • shadow (GID 42 ) -
  • utmp (GID 43 ) -
  • video (GID 44 ) -
  • sasl (GID 45 ) -
  • plugdev (GID 46 ) -
  • staff (GID 50 ) -
  • games (GID 60 ) - 一些遊戲可以 SETGID 至群組 games,可以把分數寫入最高紀錄檔案中。
  • users (GID 100 ) -
  • nogroup (GID 65534 ) -

Fedora/RHEL/CentOS 群組

[4]

  • bin (GID 1)
  • daemon (GID 2)
  • sys (GID 3)
  • adm (GID 4)
  • tty (GID 5)
  • disk (GID 6)
  • lp (GID 7)
  • mem (GID 8)
  • kmem (GID 9)
  • wheel (GID 10)
  • cdrom (GID 11)
  • mail (GID 12)
  • news (GID 13)
  • uucp (GID 14)
  • man (GID 15)
  • dialout (GID 18)
  • floppy (19)
  • games (GID 20)
  • slocate (GID 21)
  • utmp (GID 22)
  • pvm (GID 24)
  • rpcuser (GID 29)
  • gopher (GID 30)
  • rpc (GID 32)
  • tape (GID 33)
  • utempter (GID 35)
  • rpm (GID 37)
  • ntp (GID 38)
  • video (GID 39)
  • dip (GID 40)
  • ftp (GID 50)
  • lock (GID 54)
  • vcsa (GID 59)
  • audio (GID 63)
  • dbus (GID 81)
  • nobody (GID 99)
  • users (GID 100)
  • nfsnobody (GID 65534)

相關工具

  • groups - 列出所有使用者所屬的群組
  • gpasswd - 設定群組密碼和管理群組
  • groupadd - 新增群組
  • groupdel - 刪除群組
  • groupmod - 更改群組資訊

相關檔案

例子

Apple Mac OS X

Apple Mac OS X 實際將使用者的資料放入目錄服務中,master.passwd 只供系統在單使用者模式 (single-user mode) 中使用。

##
# Group Database
# 
# Note that this file is consulted directly only when the system is running
# in single-user mode.  At other times this information is provided by
# Open Directory.
#
# See the opendirectoryd(8) man page for additional information about
# Open Directory.
##
nobody:*:-2:
nogroup:*:-1:
wheel:*:0:root
daemon:*:1:root
kmem:*:2:root
sys:*:3:root
tty:*:4:root
operator:*:5:root
mail:*:6:_teamsserver
bin:*:7:
procview:*:8:root
procmod:*:9:root
owner:*:10:
everyone:*:12:
group:*:16:
staff:*:20:root
_networkd:*:24:
_installassistant:*:25:
_lp:*:26:
_postfix:*:27:

Jailbreak iOS

##
# Group Database
# 
# This file is the authoritative user database.
##
nobody:*:-2:
nogroup:*:-1:
wheel:*:0:root
daemon:*:1:root
kmem:*:2:root
sys:*:3:root
tty:*:4:root
operator:*:5:root
mail:*:6:
bin:*:7:
procview:*:8:root
procmod:*:9:root
owner:*:10:
everyone:*:12:
group:*:16:
staff:*:20:root
_wireless:*:25:
_lp:*:26:
_postfix:*:27:
_postdrop:*:28:
certusers:*:29:root,_jabber,_postfix,_cyrus,_calendar

參考資料

  1. Frisch, Æleen (2002) 6.1.6 Standard Unix Users and Groups. Essential System Administration, 3rd Edition. O'Reilly. ISBN 0-596-00343-9
  2. Debian (2010-06-28) 9.2.2 UID and GID classes, Debian Policy Manual, 3.9.0. Debian.
  3. Peña, Javier Fernández-Sanguino and Reelsen, Alexander (2010) 12.1.12.1 Are all system users necessary?, Securing Debian Manual, v3.13. Debian.
  4. Red Hat (2010) 33.4. Standard Groups, Red Hat Enterprise Linux 5 Deployment Guide, Edition 4. Red Hat

外部連結

Personal tools