Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Working with Linux Directory Permissions

In this lab, we'll be working with directory permissions on a Linux host. We'll start by creating some groups and directories, and then set up permissions to only allow each group to access its own directory.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Beginner
Duration
Clock icon 30m
Published
Clock icon Apr 15, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create user groups.

    1. There are four groups to be created:

      • accounting
      • engineering
      • management
      • hr
    2. Use the sudo groupadd -g #### [groupname] command:

      • sudo groupadd -g 1111 accounting
      • sudo groupadd -g 2222 engineering
      • sudo groupadd -g 3333 management
      • sudo groupadd -g 4444 hr
  2. Challenge

    Create directories.

    1. There are four directories to be created:
      • accounting
      • engineering
      • management
      • hr
    2. Create each group using the sudo mkdir /directoryname command:
      • sudo mkdir /accounting
      • sudo mkdir /engineering
      • sudo mkdir /management
      • sudo mkdir /hr
  3. Challenge

    Add each of the newly created directories to its associated group.

    1. Use the command sudo chgrp groupname /directoryname to add each of the newly created directories to its associated group:
      • sudo chgrp accounting /accounting
      • sudo chgrp engineering /engineering
      • sudo chgrp management /management
      • sudo chgrp hr /hr
  4. Challenge

    Set group permissions on each of the newly created directories.

    1. For each of the newly created directories, use the command sudo chmod g+rwx /directoryname to give the group owner read, write, and execute permissions to the directory:
      • sudo chmod g+rwx /accounting
      • sudo chmod g+rwx /engineering
      • sudo chmod g+rwx /management
      • sudo chmod g+rwx /hr
  5. Challenge

    Prevent non-group members from accessing files.

    1. In order to prevent other non-group members from reading and executing files in each of the newly created directories, use sudo chmod o-rx /directoryname command:
      • sudo chmod o-rx /accounting
      • sudo chmod o-rx /engineering
      • sudo chmod o-rx /management
      • sudo chmod o-rx /hr

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans