- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud
- Security

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.

Lab Info
Table of Contents
-
Challenge
Create user groups.
-
There are four groups to be created:
- accounting
- engineering
- management
- hr
-
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
-
-
Challenge
Create directories.
- There are four directories to be created:
- accounting
- engineering
- management
- hr
- Create each group using the
sudo mkdir /directoryname
command:sudo mkdir /accounting
sudo mkdir /engineering
sudo mkdir /management
sudo mkdir /hr
- There are four directories to be created:
-
Challenge
Add each of the newly created directories to its associated group.
- 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
- Use the command
-
Challenge
Set group permissions on each of the newly created directories.
- 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
- For each of the newly created directories, use the command
-
Challenge
Prevent non-group members from accessing files.
- 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
- In order to prevent other non-group members from reading and executing files in each of the newly created directories, use
About the author
Real skill practice before real-world application
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.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.