Bookmark this page

Guided Exercise: Managing Groups Using Command-line Tools

In this lab, you will add users to newly created supplementary groups.

Outcomes

The shakespeare group consists of juliet, romeo, and hamlet. The artists group contains reba, dolly, and elvis.

Perform the following steps on serverX unless directed otherwise.

  1. Become the root user at the shell prompt.

    [student@serverX ~]$ su -
    Password: redhat
  2. Create a supplementary group called shakespeare with a group ID of 30000.

    [root@serverX ~]# groupadd -g 30000 shakespeare
  3. Create a supplementary group called artists.

    [root@serverX ~]# groupadd artists
  4. Confirm that shakespeare and artists have been added by examining the /etc/group file.

    [root@serverX ~]# tail -5 /etc/group
    reba:x:1004:
    dolly:x:1005:
    elvis:x:1006:
    shakespeare:x:30000:
    artists:x:30001:
    
  5. Add the juliet user to the shakespeare group as a supplementary group.

    [root@serverX ~]# usermod -G shakespeare juliet
  6. Confirm that juliet has been added using the id command.

    [root@serverX ~]# id juliet
    uid=1001(juliet) gid=1001(juliet) groups=1001(juliet),30000(shakespeare)
    
  7. Continue adding the remaining users to groups as follows:

    1. Add romeo and hamlet to the shakespeare group.

      [root@serverX ~]# usermod -G shakespeare romeo
      [root@serverX ~]# usermod -G shakespeare hamlet
    2. Add reba, dolly, and elvis to the artists group.

      [root@serverX ~]# usermod -G artists reba
      [root@serverX ~]# usermod -G artists dolly
      [root@serverX ~]# usermod -G artists elvis
    3. Verify the supplemental group memberships by examining the /etc/group file.

      [root@serverX ~]# tail -5 /etc/group
      reba:x:1004:
      dolly:x:1005:
      elvis:x:1006:
      shakespeare:x:30000:juliet,romeo,hamlet
      artists:x:30001:reba,dolly,elvis
      
Revision: rh124-7-1b00421