Jephe Wu - http://linuxtechres.blogspot.com
Environment: CentOS 5 or 6
Objective: check selinux status
Methods:
1. check selinux status:
getenforce
or
selinuxenabled;echo $? (return 1 means disabled, 0 means enabled, man selinuxenabled)
note: use setenforce to switch between permissive or enforce mode runtime.
Accoding to Redhat knowledge base: Only if current selinux status is not disabled. you can use setenforce to set Current Enforcing Mode which can be switched between "Enforcing" and "Permissive". This setting is effective immediately but is not persistent - the system will revert to the "System Default Enforcing Mode" setting when it is restarted.
2. how to set selinux permanently
a. GUI tool: system-config-securitylevel
b. vi /etc/selinux/config or /etc/sysconfig/selinux , change SELINUX=Disabled
c. vi grub.conf,
kernel /vmlinuz-xxxx ro root=/dev/VolGroup00/LogVol00 rhgb quiet selinux=0
d. at install time, type '
linux selinux=0' to boot prompt.