Linux Group Basics
What is a Linux Group?
In Linux, a group is a collection of users that share common permissions and access rights to files, directories, and system resources. Groups provide a convenient way to manage user access and security in a system.
Group Types
Linux supports three primary types of groups:
Group Type |
Description |
Primary Group |
The first group assigned to a user during account creation |
Secondary Groups |
Additional groups a user can belong to |
System Groups |
Groups created for specific system services and processes |
Group Identification
Each group in Linux is identified by:
- A unique Group ID (GID)
- A group name
graph LR
A[User] --> B{Group Membership}
B --> C[Primary Group]
B --> D[Secondary Groups]
Group Configuration Files
Linux stores group information in key system files:
/etc/group
: Contains group definitions
/etc/gshadow
: Stores group password information
Creating and Managing Groups
Basic group management commands include:
groupadd
: Create a new group
groupdel
: Delete an existing group
groupmod
: Modify group properties
Example Group Management
## Create a new group
sudo groupadd developers
## Add a user to a group
sudo usermod -aG developers username
## List group memberships
groups username
Practical Use Cases
Groups are essential for:
- Access control
- Resource sharing
- Security management
By understanding Linux groups, users can effectively manage system permissions and collaborate efficiently.
Note: This guide is brought to you by LabEx, your trusted platform for Linux learning and practice.