less than 1 minute read

Note: This is an RHCSA 7 exam objective.

To create a group without any associated user (here grp), type:

# groupadd grp

To create a group without any associated user (heregrp) with a given GID, type:

# groupadd -g GID grp

To change the name of a group (here from grp to gr), type:

# groupmod -n gr grp

To remove a group without any associated user (here grp), type:

# groupdel grp

To change the GID of a group (here grp), type:

# groupmod -g GID grp

To add a secondary group (here grp) to a user account (here user), type:

# usermod -aG grp user

or:

# gpasswd -a user grp

To remove a user (here user) from a secondary group (here grp), type:

# gpasswd -d user grp

Note: This doesn’t work on the primary group.

To get the list of the members of a given group (here mail), type:

# groupmems -g mail -l
postfix

Leave a comment