The groupmod command’s switches with example – Unix/Linux

The “groupmod” command modify a group definition on the system.
Syntax:

# groupmod [options] GROUPNAME

Switches with example:

1, -g, –gid GID
The group ID of the given GROUP will be changed to GID.
The value of GID must be a non-negative decimal integer. This value must be unique, unless the -o option is used. Values between 0 and 999 are typically reserved for system groups.
Any files that have the old group ID and must continue to belong to GROUP, must have their group ID changed manually.
Example:

----
[[email protected] ~]# grep megrp /etc/group
megrp:x:666:
megrp2:x:666:
----
[[email protected] ~]# groupmod -g 777 megrp2
[[email protected] ~]# grep megrp /etc/group
megrp:x:666:
megrp2:x:777:

2, -h, –help

Display help message and exit.

3, -n, –new-name NEW_GROUP

The name of the group will be changed from GROUP to NEW_GROUP name.
Example:

[[email protected] ~]# groupmod -n megrpnew megrp
[[email protected] ~]# grep megrp /etc/group
megrpnew:x:666:

4, -o, –non-unique

When used with the -g option, allow to change the group GID to a non-unique value.
Example:

[[email protected] ~]# groupmod -g 501 -o megrpnew
[[email protected] ~]# grep megrp /etc/group
megrpnew:x:501:

5, -p, –password PASSWORD
The encrypted password, as returned by crypt(3).
Note: This option is not recommended because the password (or encrypted password) will be visible by users listing the processes. You should make sure the password respects the system´s password policy.

That’s it!! 🙂

Related Links:
groupdel, groupmems, groupadd,

More:
ls, head, tail, top, ps, find, crontab

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

2 Responses

  1. February 1, 2014

    […] Related Links : groupadd , groupmems, groupmod, […]

  2. February 7, 2014

    […] useful commands: groupdel, groupmems, groupmod, useradd , usermod , chgrp, chown, ls, head, tail, top, ps, find, crontab, ftp commands, […]

Leave a Reply

Your email address will not be published. Required fields are marked *