This hands-on lab allows you to practice troubleshooting and resolving SELinux filesystem context issues. Being able to discover and resolve SELinux context issues is a key concept when working with SELinux. At the end of this activity, you will understand how to view and apply new security contexts to files and directories.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Check the Directory and Index File Security Context
Compare the SELinux security context of
/var/www/html
to the/var/www/html/web-api
directory to determine if the context of the new directory and its contents need to be adjusted:- View the context of the
html
directory by runningls -Z /var/www
. - View the context of the
web-api
directory by runningls -Z /var/www/html/web-api
.
- View the context of the
- Restore the Appropriate Security Context to the API Directory
- Restore the context of the files and directories in the
web /var/www/html
directory by runningsudo restorecon -R /var/www/html/web-api
. - View the updated context by running
ls -Z /var/www/html/web-api
. - Verify that the update is working by running
curl localhost/web-api/index.html
.
- Restore the context of the files and directories in the