Creating Users and Groups from the Command Line

45 minutes
  • 3 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will practice adding users and groups from the command line. Creating, managing, and removing users and groups is a fundamental skill in Linux system administration.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create the Required Users

Note: Please wait 1-2 minutes after starting the lab to enable all the lab resources to provision.

  1. Run the following command:
    for i in jen william matt sam anne danny kate bruce; do sudo useradd -m $i; done
Create the Required Groups
  1. Run the following commands:
    sudo groupadd management
    sudo groupadd sales
    sudo groupadd operations
Add Members to the Appropriate Groups
  1. Add jen to all groups.
    for i in management sales operations ; do sudo usermod -a -G $i jen; done
  2. Add william to all groups.
    for i in management sales operations ; do sudo usermod -a -G $i william; done
  3. Add the users matt, sam, anne, and danny to the sales group.
    for i in matt sam anne danny; do sudo usermod -a -G sales $i; done
  4. Add the users kate and bruce to the operations group.
    for i in kate bruce; do sudo usermod -a -G operations $i; done
  5. Run one of the following commands to verify that group membership has been configured correctly for all users:

    tail -n3 /etc/group

    or

    for i in jen william matt sam anne danny kate bruce; do groups $i; done

Additional Resources

Note: Please wait 1-2 minutes after starting the lab to enable all the lab resources to provision.

Your organization has asked you to configure a new Linux server for department usage. The organization of employees is as follows:

Management

  • Jen
  • William

Sales

  • Matt
  • Sam
  • Anne
  • Danny

Operations

  • Kate
  • Bruce

Managers should belong to all groups, and department members should belong to their respective groups.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?