cancel
Showing results for 
Search instead for 
Did you mean: 
TudorRaduta
Community Manager
Community Manager
  • 128 Views

That moment you realize chcon isn't permanent... :(

Let's Talk SELinux: `chcon` vs `restorecon`

Hey everyone, hope you had a great weekend!

Alright, let's talk about the topic that can feel like a final boss in a video game when you're studying for the RHCSA: SELinux.

We all know the golden rule for the exam: everything has to survive a reboot! This is the exact spot where the chcon command can trick you. It feels like you fixed the problem, but that fix vanishes after a restart.

So, my mission this week is to get this down cold. Here's the simple way I'm trying to remember it:

The Quick Fix (chcon This is great for a temporary test. It changes the file's label right now, but the change can get wiped out if the system ever does a full relabel.

The Real Fix (semanage fcontext + restorecon This is the one we need for the permanent configuration. You're basically telling the main SELinux policy "Hey, this is the correct label for this file forever," and then restorecon makes it happen.

So, a couple of questions for you all:

  1. Besides SELinux, what's another RHCSA topic that's currently giving you a headache?
  2. Who's been bitten by this chcon vs restorecon thing before? Share your story!

Jump in the comments and let's figure this stuff out together!

Labels (2)
2 Replies
Chetan_Tiwary_
Community Manager
Community Manager
  • 68 Views

TudorRaduta
Community Manager
Community Manager
  • 64 Views

Thank you for resurfacing this great resource @Chetan_Tiwary_ 

Join the discussion
You must log in to join this conversation.