Identify SELinux File Context

Red Hat Enterprise LinuxBeginner
Practice Now

Introduction

In this challenge, you will practice identifying and modifying SELinux file contexts on a Red Hat Enterprise Linux (RHEL) system. SELinux (Security-Enhanced Linux) is a critical security mechanism that provides mandatory access control (MAC). Understanding how to work with SELinux file contexts is essential for system administration and security management.

Identify and Modify SELinux File Context

Your first task is to work with SELinux contexts on files. You will create a new file, inspect its default SELinux context, and then modify its type context.

Tasks

  • Create a new, empty file named example.txt.
  • View the full SELinux context of the example.txt file.
  • Change the SELinux type context of example.txt to admin_home_t.

Requirements

  • All operations must be performed within the ~/project directory.
  • The file must be named example.txt.
  • Use the ls -Z command to view the file context.
  • Use the chcon command to modify the file context. The final type context must be admin_home_t.

Summary

In this challenge, you have successfully practiced fundamental SELinux file context management. You learned how to view the security context of files using ls -Z and modify them temporarily with chcon. These skills are foundational for managing a secure RHEL system and understanding how SELinux contexts work.

✨ Check Solution and Practice