How to make a group in Linux

July 10, 2024 / Command Line

When your Linux distribution supports multiple users, managing permissions through groups is more efficient than individually assigning permissions to each user. By creating groups with specific permissions and adding users to these groups, you can extend those permissions to all group members uniformly.

This guide explains how to make a group in Linux.

Follow the steps-

  1. Launch the terminal on your Linux system.
  2. Use the ‘groupadd’ command:
    Syntax:
    sudo groupadd group_name
    Example:
    sudo groupadd developers
  3. Verify group creation:
    Check group creation:
    getent group developers
  4. Add users to the group:
    Syntax:
    sudo usermod -aG group_name username
    Example:
    sudo usermod -aG developers john
  5. Manage group permissions:
    Change group ownership:
    sudo chgrp group_name /path/to/file_or_directory
  6. Remove a group (optional):
    Syntax:
    sudo groupdel group_name
    Example:
    sudo groupdel developersNote: Deleting a group is irreversible and may affect file permissions.

Creating groups in Linux using the groupadd command enables well-organized user management and permissions assignment across your system.

Spread the love