Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

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

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
    • Security
Google Cloud Platform icon
Labs

SELinux Learning Activity

In this lab we'll use SELinux to resolve a scenario that is common in the real world. Doing this will help to understand the tools available and where to look when troubleshooting SELinux issues. *This course is not approved or sponsored by Red Hat.*

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Aug 29, 2025
Duration
30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Fix the Selinux Permissions on `/opt/website` so That They'll Survive a Relabel
    • First we'll check to see what the label needs to be. Websites are normally stored in /var/www/html so we can look there to see what it should be.
    • We can see that the context should be set to httpd_sys_content_t.
    • The command we need to run is: semanage fcontext -a -t httpd_sys_content_t '/opt/website(/.*)?'
    • This makes a change in the SELinux database.
    • We then need to run restorecon /opt/website to actually make the change on the filesystem.
    • This will set the directory to the correct context and protect that change from a relabel in the future.
  2. Challenge

    Deploy the Website as Instructed and Test It
    • We've been instructed to deploy the website by running mv /root/index.html /opt/website/.
    • We can then try a curl localhost/index.html to test our deploy.
    • If we get a 403 Forbidden error, test if SELinux is the problem by running setenforce 0 and then running curl again.
    • If the curl works with SELinux in permissive mode, we can set it back to enforcing with setenforce 1 and then investigate why.
  3. Challenge

    Resolve the Error When Trying to Access `/opt/website/index.html`
    • ls -lZ /opt/website will show that index.html has a content type of admin_home_t which isn't what we need when serving webpages.
    • We can run restorecon /opt/website/index.html to fix this error and the curl will work.
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

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.

Get started with Pluralsight