SYS: Create, delete, and modify local groups and group memberships.

Share this link

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 (here grp) 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
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.00 out of 5)
Loading...

Leave a Reply

2 Comments on "SYS: Create, delete, and modify local groups and group memberships."

Notify of
Sort by:   newest | oldest
fernandezcuesta
Member
fernandezcuesta

-n flag missing:

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

— # groupmod gr grp
++ # groupmod -n gr grp

wpDiscuz

RHCSA7: Task of the day

Allowed time: 10 minutes.
Boot and change the root password before the end of the boot process.

RHCE7: Task of the day

Allowed time: 15 minutes.
Configure a httpd server with a password protected directory under the /var/www/html/private directory.

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...

Recent Comments