How to modify group properties?

You can modify group properties in Linux using the groupmod command. This command allows you to change the name or GID (Group ID) of an existing group.

Basic Syntax

groupmod [options] group_name

Options

  1. Change Group Name:

    • To change the name of a group, use the -n option:
    groupmod -n new_group_name old_group_name
  2. Change Group ID:

    • To change the GID of a group, use the -g option:
    groupmod -g new_gid group_name

Examples

  1. Change Group Name:
    To change the group name from oldgroup to newgroup:

    sudo groupmod -n newgroup oldgroup
  2. Change Group ID:
    To change the GID of the group mygroup to 1001:

    sudo groupmod -g 1001 mygroup

Summary

The groupmod command is a powerful tool for modifying existing group properties, allowing you to change group names and GIDs as needed. Always ensure you have the necessary permissions (usually root) to make these changes.

0 Comments

no data
Be the first to share your comment!