etc group檔案詳解

2021-06-17 01:19:12 字數 1173 閱讀 4618

例:

1 root:x:0:

2 daemon:x:1:

3 bin:x:2:

4 sys:x:3:

5 adm:x:4:hacker

6 tty:x:5:

7 disk:x:6:

8 lp:x:7:

9 mail:x:8:

10 news:x:9:

11 uucp:x:10:

12 man:x:12:

13 proxy:x:13:

組名:口令:組標識號:組內使用者列表

1)「組名」是使用者組的名稱,由字母或數字構成。與/etc/passwd中的登入名一樣,組名不應重複。

2)「口令」字段存放的是使用者組加密後的口令字。一般linux系統的使用者組都沒有口令,即這個字段一般為空,或者是*。

3)「組標識號」與使用者標識號類似,也是乙個整數,被系統內部用來標識組。

4)「組內使用者列表」是屬於這個組的所有使用者的列表/b],不同使用者之間用逗號(,)分隔。這個使用者組可能是使用者的主組,也可能是附加組。

名稱::

getgroups/setgroups/initgroups

功能:get group file entry

標頭檔案:

#include

#include

函式原形:

int getgroups(int gidsetsize,gid_t grouplist);

int setgroups(int ngroups,const gid_t grouplist);

int initgrops(const char *username,gid_t basegid);

引數:grouplist  用於存放附加組id

gidsetsize  最大存放id的個數 

ngroups 

陣列中元素的個數

username 

使用者名稱返回值:

getgroups  若成功則返回附加組id數,若出錯則返回-1

setgroups/ initgrops  若成功則返回0,若出錯則返回-1

乙個使用者不僅屬於口令檔案記錄項中組id所對應的組。也可以屬於多達16個另外的組。在這裡另外的組id叫附加組id。這樣我們就可以實現乙個人屬於多個組了。下面的例子功能是列印當前使用者的附加主組id。

etc group檔案詳解

linux etc group檔案與 etc passwd和 etc shadow檔案都是有關於系統管理員對使用者和使用者組管理時相關的檔案。linux etc group檔案是有關於系統管理員對使用者和使用者組管理的檔案,linux使用者組的所有資訊都存放在 etc group檔案中。具有某種共同...

etc group檔案詳解

linux etc group檔案與 etc passwd和 etc shadow檔案都是有關於系統管理員對使用者和使用者組管理時相關的檔案。linux etc group檔案是有關於系統管理員對使用者和使用者組管理的檔案,linux使用者組的所有資訊都存放在 etc group檔案中。具有某種共同...

組資訊檔案 etc group內容詳解

這個檔案是記錄組id gid 和組名的對應檔案。etc passwd檔案的第四個字段記錄的是每個使用者的初始組的id,那麼這個gid的組名到底是什麼呢?就要 etc group檔案中查詢。這個檔案的內容如下 root localhost vim etc group root x 0 bin x 1 ...