How to Create a Group in Linux

December 8, 2023 / How-to Guide

This guide explains how to create groups in Linux, which helps manage user per permissions more efficiently than assigning permissions individually.

Follow these steps to create a group:

  1. Open a terminal and use the groupadd command:
    sudo groupadd groupname

    Replace groupname with your desired group name.

  2. (Optional) Assign a specific GID (Group ID):
    sudo groupadd -g 1073 groupname

    Replace 1073 with a 4-digit number not already in use.

  3. Verify the group was created:
    getent group groupname

Important Notes:

  • You need sudo or root privileges.
  • If the group already exists, you will see an error.
  • If the GID is already used, you will get a conflict error.
  • Use sudo groupadd -g to specify a custom GID.

Next Steps: After creating the group, add users to it using:

sudo usermod -a -G groupname username

In this way, you can create a group in Linux. For more information on Linux, visit our knowledge base section.

Configuring user roles and permissions on Linux?
A Linux VPS Hosting solution provides the control needed to manage groups, restrict access and maintain a secure multi-user environment.
Spread the love