Directory with specific persistent SELinux security context keeps getting relabeled to default_t on reboot

Solution Verified - Updated -

Issue

A custom directory under the root filesystem, say '/example/', is required to have the SELinux security context type 'home_root_t'. For persistence of the security context, an SELinux policy module containing the file context rule is loaded on the system, with the entry given below.

/example                         system_u:object_r:home_root_t:s0

When the 'restorecon' command is run on the directory, the SELinux security context is set correctly, as expected.

However after every reboot, the directory is being relabeled as 'default_t'.

Environment

Red Hat Enterprise Linux 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content