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)

  1. Feb
    1
    Fri

    1. 8:30 am - View Details
      CentOS: Dojo, Brussels, Belgium.

RHCSA7: Task of the day

Allowed time: 5 minutes.
Create a user called tom. Create a directory named /private. Use an acl to only allow access (rwx) to tom to the private directory.

RHCE7: Task of the day

Allowed time: 5 minutes.
Set up time synchronization with default configuration.

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