≡ Menu

HowTo: Temporarily Switch Off SELinux Enforcement

How do I temporarily switch off SELinux enforcement under Red Hat Enterprise Linux server version 6.x using command prompt? How do I turn on SELinux enforcement again?

SELinux can be run in any one of the following mode at any given time:

  1. enforcing : SELinux security policy is enforced.
  2. permissive : SELinux prints warnings instead of enforcing.
  3. disabled : SELinux is fully disabled.

You can use /selinux/enforce file to temporarily switch off SELinux enforcement on or off (i.e. set in permissive mode) using the following syntax.

Temporarily switch off SELinux enforcement

Type the following command as root user:
# echo 0 >/selinux/enforce
Type the following command to see current status, enter:
# sestatus
Sample outputs:

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   permissive
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted

Temporarily switch on SELinux enforcement

Type the following command as root user:
# echo 1 >/selinux/enforce
Type the following command to see current status, enter:
# sestatus
Sample outputs:

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted
Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 1 comment… add one }
  • Pavel September 27, 2016, 9:37 pm

    bash: /selinux/enforce: No such file or directory

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , ,