Loading...
Linux Interview Questions

Group Administration

Group Administration

1.What is a group in Linux?
A) A group is a collection of users. Groups allow shared permissions on files and directories.

2.What’s the difference between primary and secondary groups?
A)

  • Primary group → Assigned when a user is created (from /etc/passwd). Files created by the user belong to this group.
  • Secondary group(s) → Additional groups that user is a member of, granting extra permissions.

 

3.How do you create a new group & delete a group?
A)

groupadd groupname
groupdel groupname

4.How do you remove a user from a group?
A)

gpasswd -d username developers

5.How do you change a user’s primary group?
A)

usermod -g groupname username

6.How do you check which groups a user belongs to?
A)

id username
groups username
7.Where are group details stored in Linux?
A) /etc/group → group names, GIDs, members
/etc/gshadow → group passwords and secure info

8.What is a GID (Group ID)?
A) Each group has a unique numeric ID (GID). It’s stored in /etc/group and used by the kernel to apply permissions.

9.How do you change a group’s GID?
A)

groupmod -g 2001 groupname

10.How do you rename a group?
A)

groupmod -n newgroupname oldgroupname

11.How do you set a group password?
A)

gpasswd groupname

12.Can a user have multiple primary groups?
A) No. Each user can have only one primary group, but multiple secondary groups.

13.how to change the group ownership of a file/directory?
A)

chgrp groupname filename

14.How do you find files owned by a specific group?
A)

find / -group groupname

15 How do you change group membership for multiple users at once?
A)

gpasswd -M user1,user2,user3 groupname
Leave a Reply

Your email address will not be published. Required fields are marked *