You are currently viewing Linux Commands – groupmod

Linux Commands – groupmod

  • Post author:
  • Post category:Linux

Linux Commands – groupmod

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed groupadd command in Linux which is used to create a new group in Linux.

https://cloudaffaire.com/linux-commands-groupadd/

In this blog post, we will discuss groupmod command in Linux. groupmod command can be used to modify an existing group attribute. The groupmod command modifies the definition of the specified GROUP by modifying the appropriate entry in the group database. You need root or sudo privileges to modify a group.

Linux Commands – groupmod:

You can use groupmod -n or –new-name NEW_GROUP options to rename an existing group.

You can use groupmod -g GID or –gid GID options to change the group id of an existing group. The value of GID must be a non-negative decimal integer and must be unique, unless the -o option is used. Users who use the group as primary group will be updated to keep the group as their primary group. Any files that have the old group ID and must continue to belong to GROUP, must have their group ID changed manually. No checks will be performed with regard to the GID_MIN, GID_MAX, SYS_GID_MIN, or SYS_GID_MAX from /etc/login.defs.

You can use groupmod -o or –non-unique options to change the group GID to a non-unique value when used with the -g option.

You can use groupmod -p or –password PASSWORD options to set or change a password to a group. Please note that group password is not secure and can be listed.

You can use groupdel command to delete a group. In order to delete a group using groupdel command, the group must exist and should not be the sole primary group of a user. If the group is the sole primary group of a user, then you need to change the primary group to another group. The groupdel command modifies the system account files, deleting all entries that refer to GROUP. You should also manually check all file systems to ensure that no files remain owned by this group.

Hope you have enjoyed this article. In the next blog post, we will discuss useradd command in Linux.