Wednesday, September 28, 2011

Turning on/off SELINUX on Linux

1. Temporarily switch off enforcement
You can switch the system into permissive mode with the following command:
# echo 0 >/selinux/enforce
You'll need to be logged in as root, and in the sysadm_r role:
# newrole -r sysadm_r

2. To switch back into enforcing mode:
# echo 1 >/selinux/enforce

In Fedora Core and RedHat Enterprise Linux you can use the setenforce command with a 0 or 1 option to set permissive or enforcing mode, its just a slightly easier command than the above.
To check what mode the system is in,

cat /selinux/enforce

No comments:

Post a Comment