Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Shell Scripting
  • Kali Linux
  • Ubuntu
  • Red Hat
  • CentOS
  • Docker in Linux
  • Kubernetes in Linux
  • Linux interview question
  • Python
  • R
  • Java
  • C
  • C++
  • JavaScript
  • DSA
Open In App
Next Article:
How to Create, Delete, and Modify Groups in Linux
Next article icon

How to Create, Delete, and Modify Groups in Linux

Last Updated : 26 Mar, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

If you're using Linux—whether on a personal system, a company server, or a shared network—knowing how to manage groups is essential for handling multiple users efficiently. In simple terms, a group in Linux is a way to give shared access and permissions to multiple users without setting things up one by one.

In this article, we’ll cover everything you need to know about creating, deleting, and modifying Linux groups, along with the best practices for group-based access control. Whether you're a beginner or a system admin, understanding how to use Linux group management commands like groupadd, usermod, groupdel, and groupmod can boost your efficiency and improve your system’s security and structure.

What Is a Group in Linux?

In Linux, a group is used to manage the access permissions for more than one user at the same time. Instead of assigning file or directory access to all users separately, you can set up a group, add members to it, and assign privileges to the group. This is easier to access quicker, neater, and more securely when you're operating with multiple users or a team.

Why Use Groups in Linux?

Imagine a Linux group like a shared workspace. Any member of the group can read, edit, or view the same files—if the group has the access. This is ideal for:

  • Project teams in a company
  • Admins vs standard users
  • Shared computers at schools or labs

For example: You have a group of web developers. Rather than granting all developers read access to the project files individually, you create a group named devs and add all members to it. Then you establish permissions so devs can read and write in the project directory. All done in one step, everyone has the access they require.

Types of Linux Groups:

There are two types of groups in linux:

  • Primary Group: This is a user's default group when they are created. A user belongs to one primary group.
  • Secondary Group: These are groups a user can also join. Secondary groups provide additional access to resources without modifying the user's primary group.

For more details refer Group Management in Linux

How to Create a Group in Linux

Creating a groups on Linux enables us to set functionally similar users under one group for easier access management. This is useful for teams like developers, designers, or admins that need to collaborate on files in a centralized location.

Command to Create a New Group:

sudo groupadd groupname

For more details refer How to Create a new group in Linux | groupadd command

How to View All Groups in Linux

To check for existing groups on a Linux machine, you can execute a couple of commands which will show the groups available.

Command to List All Groups:

cut -d: -f1 /etc/group      # This command displays a simple list of all group names on your system
OR
getent group

How to Check Group Membership of a User

To check which groups a given user belongs to, the groups command can be used.

Syntax:

groups username

Also Read: How to Check the Groups a User Belongs to in Linux

How to Add a User to a Group

Adding a user to a group lets them access shared files, folders, and permissions tied to that group. This is useful when managing teams or giving specific rights.

Syntax:

sudo usermod -aG groupname username

The -aG option appends the user to the new group without removing them from their existing groups.

For more details refer How to Add User to a Group in Linux

How to Remove a User from a Group

When a user is removed from the group, that user loses the resources and privileges that are available through that group.

Syntax:

sudo gpasswd -d username groupname           # This command deletes the user from the specified group

For more details refer How to Remove Users from Groups in Linux

How to Change a User's Primary Group

In Linux, every user is allocated one primary group. His owning this primary group means that for all new files created by that user, the ownership group will be set to this primary group.

Syntax:

sudo usermod -g newgroup username

For more details refer How to Change The Primary Group of a User in Linux

How to Delete a Group in Linux

Removing a group from the system does delete the users from that group and all their details are retained irrespective of the specific group.

Syntax:

sudo groupdel groupname

For more details refer How to Delete a Group in Linux | groupdel command

How to Modify a Group in Linux

You can use groupmod to rename a group. This is convenient when names for groups need to be regularized or changed.

Syntax:

sudo groupmod -n newgroup oldgroup

Common Use Cases for Managing Groups

Groups in Linux are powerful when you want to organize users and control access without setting permissions individually

ScenarioWhy Use Groups
File sharing within a teamInstead of giving file access to each user manually, assign all members to a group so they automatically share access.
Admin vs regular user accessHelps create a secure environment by grouping users based on roles. Admins can have elevated permissions while regular users stay restricted.
Server managementGroups allow certain users to execute administrative tasks (like using sudo) without affecting others.
Educational institutionsSchools and colleges use groups to separate permissions for students, teachers, and IT staff. Each group can access only what's relevant to them.

Conclusion

Linux groups are a core part of system management and user access control. From creating a group for a development team to removing outdated permissions, group commands let you manage multiple users efficiently and securely. With just a few commands—like groupadd, usermod, groupdel, and groupmod—you can organize users, control access to files and tools, and keep your Linux system clean and secure.

Whether you're managing users in a school, office, or cloud server, groups make it easier to apply the right access to the right people—without confusion or clutter. In a world where data security and user management matter more than ever, mastering group management is a simple yet powerful skill every Linux user should have.


Next Article
How to Create, Delete, and Modify Groups in Linux

S

shudhanshu5j5r
Improve
Article Tags :
  • Linux-Unix
  • linux

Similar Reads

    How to Create Directory in Linux | mkdir Command
    In Linux, the 'mkdir' command is like a magic wand for creating folders super easily. 'mkdir' stands for "make directory," and it helps you organize your computer stuff by creating folders with just one command. Whether you're making one folder or a bunch of them in a row, 'mkdir' is there to help y
    7 min read
    How to Delete a Group in Linux | groupdel command
    Group management is a crucial aspect of Linux system administration, and understanding how to create, modify, and delete groups is essential for maintaining a secure and organized environment. In this article, we will delve into the process of deleting a group in Linux using the 'groupdel' command.
    3 min read
    How to Create a new group in Linux | groupadd command
    In the Linux operating system, user management is a crucial aspect of system administration. One of the fundamental tasks is creating and managing user groups. Groups in Linux allow administrators to organize and control user access to various resources and files. The groupadd command is a powerful
    7 min read
    How to Add User to a Group in Linux
    A group in Linux is a way to put users with similar access and permissions in a collection. By using groups, an administrator can define access control and permissions for all the users belonging to that group. Without groups, the administrator would have to define roles for individual users however
    7 min read
    How to Rename a Group in Linux?
    Renaming a group in a Linux system is a straightforward but essential administrative task. If you're reorganizing your user management structure or enhancing security measures, this quick guide will walk you through the simple steps to rename a group. Linux provides a powerful command, 'groupmod' to
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences