Pawan Sharma | May 22, 2012 | Be the first to comment!

Understanding /etc/group

In this post we will discuss about an important file /etc/group. To pass Redhat Certified System Administration(RHCSA) exam we need to know all important files related to user administration. In /etc/group file we can find group related all user groups in Linux operating system. 

When a user is added , a user private group is created and the corresponding entry is put in /etc/group. /etc/group contains 4 fields and are
explained below

1. GROUP NAME: which is the same as USER_NAME which is specified with the useradd command.

2. GROUP PASSWORD: Group Password can be given using the command gpasswd .

   For eg:     gpasswd pawan
                   Changing the password for group pawan
                   New Password:
                   Re-enter new password:

3. GID -> Group ID which is the same as UID.

4. The last field discribe ther members of the group except the user which is already a member of the group .

   A user is added to a group using the follwing command -:

   usermod -G GROUP_NAME USER_NAME

   For eg:  usermod -G pawan major_group

   A Group can also be created using the command groupadd

   For eg:  groupadd major_group

   An entry for the "major_group" group will be placed in the file /etc/group.

If we want to give same permissions to few users, we can make them member of a group. By making some users member of a group we can give permission to that group and all users in that group will get that permission. We can also set Access Control Lists (ACL) on group.

No comments:

Post a Comment