There are times where you want to remove a user group from Linux. This section guides you on how to delete a Linux Group properly.
Before starting to remove the group, you must ensure that all the files and directories owned by the group is changed to a new group owner. Otherwise, it can very hectics and requires root account to do a bunch of clean-up works.
First identity the new group owner and change all the files and directory to the new owner. You have 2 ways to do that:
$ chgrp {-R} [group] [file|directory]
OR
$ chown {-R} [user]{:group} [file|directory]
Example:
$ chgrp -R new-group /media/localstore/datacare
OR
$ chown -R :new-group /media/localstore/datacare
Next thing to do is to coordinate with your devops to communicate with users (if needed) that the users can no longer access the data under the group. This can takes some times for mitigations.
This step may or may not be feasible depending on the types of users (some are quite screamy when things don't works) and organization (power crazy managers pressure that threatens dept mindlessly). If it does, you can simulate or migrate users by users via removing him/her from the to-be-deleted group and handle his/her case subtly.
Once you're done with it, you can proceed to remove group. To do that, simply issue the following command:
$ groupdel <group>
Example:
$ groupdel mygroup1
That's all for removing group from a Linux Operating System.