Understanding /etc/group



/etc/group

This file contains the group names with GID (group identifier) and defines which user belongs to which group.  It is a simple text file stored under “etc” directory.  The “/etc/group” file has a similar role for groups as the “/etc/passwd” file has for users. This file contains one entry per line and each entry has four fields that are separated by a colon (:).

The entry in this file looks like given below:

Groupname: password: GID:list of users 

Field

Description

Groupname

The name of the group.

Password

The encrypted password of the group represented by x.

GID

This field contains the group identification number.

List of users

It contains the names of users that are members.

 

To access the “/etc/group” file you can use commands like cat, tail, head, etc.


From the above image “hockey” is a group name, “x” is the encrypted password, 1004 is a GID, and user2, john, and user1 are the members of the group hockey.

 The command “cat” is short of “concatenate” it allows us to view file content, redirect output in terminal or file, create single or multiple files, and concatenate files.

The “pipe” is a vertical bar (|) on the command line between two commands. The pipe basically takes the output from one command and use it as input for another command.

The “grep” stands for (globally search for a regular expression and print out) is used to filter search through a pattern of characters, and displays all lines related to the pattern.

 

 


No comments:

Post a Comment

Featured Post

Managing user and groups, UID and GID in Linux

What are users in the operating system? A user is a person who accesses or utilizes computer resources or network services. In order to ...

Popular Posts