Linux Group Basics
What is a Linux Group?
In Linux, a group is a collection of users with shared permissions and access rights. Groups provide a convenient way to manage system resources and control user access to files, directories, and other system components.
Group Types
Linux supports two primary types of groups:
Group Type |
Description |
Example |
Primary Group |
The first group assigned to a user during account creation |
users |
Secondary Group |
Additional groups a user can belong to |
developers , wheel |
Group Identification
Each group in Linux is identified by:
- A unique Group ID (GID)
- A group name
graph LR
A[User] --> B[Primary Group]
A --> C[Secondary Group 1]
A --> D[Secondary Group 2]
Group details are stored in key system files:
/etc/group
: Contains group information
/etc/gshadow
: Stores group password information
Basic Group Commands
## View groups for current user
groups
## List all system groups
cat /etc/group
## Create a new group
sudo groupadd myteam
## Add user to a group
sudo usermod -aG myteam username
Group Permissions Concept
Groups allow administrators to:
- Simplify access management
- Implement granular security controls
- Share resources efficiently
At LabEx, we recommend understanding group mechanics as a fundamental Linux system administration skill.