Groups are important in Linux systems. In order to have a well secured distro, you will need to set security rules on both users and groups. The information about the groups is stored in /etc/group.
How to create groups in Linux with: groupadd
$ sudo groupadd mikegr
$ < /etc/group grep mikegr
With groupadd and no arguments, a new group will be with the default setting. The GID will be the first one available, bigger than 1000 (because from 1 to 999 the GIDs are reserved).
You can also create a group with a customized GID:
$ sudo groupadd -g 1033 starwarsmovie
$ < /etc/group grep starwarsmovie
It is not recommended to create a password protected group with groupadd -p because you’re password will be stored in /etc/gshadow in clear format, not encrypted. (unless you give groupadd -p a crypted password as an argument)
$ sudo groupadd -p "linuxg.net" geekster
$ < /etc/group grep geekster
$ sudo < /etc/gshadow grep geekster
Deleting a group is very simple with groupdel:
$ sudo groupdel geekster
We did not get any output, so the group has been succesfully deleted.
If you need to change the group settings, use groupmod:
Usage: groupmod [options] GROUP
-g, --gid GID change the group ID to GID
-h, --help display this help message and exit
-n, --new-name NEW_GROUP change the name to NEW_GROUP
-o, --non-unique allow to use a duplicate (non-unique) GID
-p, --password PASSWORD change the password to this (encrypted)