Restoring the Default File Type

In this task, you reverse the change you made in the previous task, restoring the default file type of the directory hierarchy /var/webcontent.

  1. Delete the existing file type definition.

    Use the semanage command to delete the file type definition for the directory hierarchy from the /etc/selinux/targeted/contexts/files/file_contexts.local file:

    sudo /usr/sbin/semanage fcontext -d "/var/webcontent(/.*)?"
  2. Apply the default file type.

    Use the restorecon command to apply the default file type to the entire directory hierarchy:

    sudo /sbin/restorecon -R -v /var/webcontent