Featured resource
Tech Upskilling Playbook 2025
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Learn more
  • Labs icon Lab
  • Core Tech
Google Cloud Platform icon
Labs

Linux Security: Implement SELinux

In this lab, you will gain practical experience with managing different SELinux modes and configuring its file. You will also learn how to inspect the context of a file, directory, or process. Additionally, you will understand how to change the SELinux context of files and directories using the chcon and semanage commands. For example, you will change the context type of the root directory of the Apache web server temporarily, and then make it permanent by modifying the SELinux policy. Additionally, you will explore how to configure SELinux booleans.

Google Cloud Platform icon
Labs

Path Info

Rating
(14 reviews)
Level
Clock icon Beginner
Duration
Clock icon 1h 5m
Last updated
Clock icon Aug 04, 2025

Contact sales

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

Table of Contents

  1. Challenge

    Get Started in the Lab Environment

    Here are the initial instructions and explanation of the lab environment. Read this while your environment is busy creating itself from nothing. Yes, this violates physics; we know. How fun!

  2. Challenge

    Manage SELinux Modes

    To start the lab, you will gain hands-on experience in understanding the different modes of SELinux and its configuration file. You will also learn how to switch between permissive mode and enforcing mode on a running system, and how to make these changes permanent by modifying the SELinux configuration file.

  3. Challenge

    Examine the SELinux Context

    You will now learn how to inspect the context of a file, directory, or process. This will help you understand which processes can access specific files, directories, and ports. You will also explore how SELinux assigns labels to processes and files through a context, which includes details such as an SELinux user, role, type, and, optionally, a level.

  4. Challenge

    Change the Context Type

    Your objective is to modify the context type of the root directory in the Apache web server, and then check the response of the Apache web page.

  5. Challenge

    Configure SELinux Booleans

    In this challenge, you will learn how to list and obtain information about SELinux booleans on the server. This includes the current status, default status, and description of each boolean. Additionally, you will practice changing the SELinux boolean setting of ftp_home_dir from off to on.

  6. Challenge

    Change the SELinux Context Type Permanently

    To finish this lab, you will learn how to change the SELinux context type of files and directories using the semanage and chcon commands. First, you will create a new root directory for the Apache webserver called /webpage. Until you change the context type of this directory from the default to httpd_sys_content_t, the Apache process will not be able to access the web content placed in the /webpage directory. Additionally, you will learn how to make these changes permanent by adding them to the SELinux policy using the semanage command.

Shikhar is a professional system administrator and consultant that has a particular interest in all things related to Linux administration, shell scripting, cloud, Ansible, and automation. He loves making complex technical topics easy to understand. He is an AWS Certified Solutions Architect Associate. He has utilized his IT skills in many Fortune 500 companies. Shikhar has been teaching since 2015 and provides onsite and online training on many IT subjects.

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.