SELinux has a total of 3 states.
1. SELinux configuration file:/etc/selinux/config
# This file controls the state of the SELinux on the system.
3 # selinux= can take one of these three values:
4 # Enforcing-selinux Security policy is enforced.
5 # Permissive-selinux Prints warnings instead of enforcing.
6 # Disabled-no SELinux policy is loaded.
7 selinux=permissive
8 # selinuxtype= can take one of three the values:
9 # targeted-targeted processes is protected,
Ten # Minimum-modification of targeted policy. Only selected processes is protected.
# Mls-multi level Security protection.
selinuxtype=targeted
Enforcing: Mandatory mode, on behalf of the SELinux operation, and has correctly begun to limit domain/type; permissive: Tolerance mode: Represents SELinux operation, but only a warning message does not actually restrict domain/type access. This model can be shipped as the use of SELinux debug;
disabled: Off, SELinux does not actually work.
2. Check the status of SELinux now:
Sestatus
3, permanently change the status of SELinux, need to re-boot, because SELinux is integrated into the kernel module.
4. Temporary Closure Selinux:setenforce 0
5, temporarily open, from permissive to Enforcing:setenforce 1
6. Use the SED command to modify the SELinux configuration file:
Sed-i '/selinux/s/enforcing/disabled/'/etc/selinux/config
Explanation:/selinux/is a line containing characters that match in//
S is the replacement command
Sed-i indicates that the source file is modified directly, and no-I simply outputs the modification to standard output and does not modify the source file.
S/the string to look for/changed string/
Note that the entire command is enclosed in single quotation marks.
Finally, keep up with the file name
SELinux tolerant mode (permissive) forced mode (enforcing) off (disabled)