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...

2
Leave a Reply

Please Login to comment
1 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
CertDepotfernandezcuesta Recent comment authors
  Subscribe  
newest oldest
Notify of
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

Upcoming Events (Local Time)

There are no events.

RHCSA7: Task of the day

Allowed time: 10 minutes.
Create an EXT4 file system mounted by UUID in /etc/fstab under /vol based on a logical volume of 28 logical extents.

RHCE7: Task of the day

Allowed time: 15 minutes.
Configure a Samba server called MYSERVER, belonging to the MYGROUP group, sharing the /shared directory with the name "shared".

Follow me on Twitter

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 ...