Applicable to:
- Plesk for Linux
Question
How to disable SELinux on a server?
Answer
To temporary change SELinux mode on a server (until next server reboot if not changed back manually), use the setenforce
command with the parameters 0 (permissive mode) and 1 (enforcing mode):
-
permissive
(option 0) - The SELinux system prints warnings, but does not enforce policy. Commonly used for troubleshooting. -
enforcing
(option 1) - The SELinux security policy is enforced.To change SELinux mode to "permissive"
-
Connect to a server via SSH.
-
Run the command:
# setenforce 0
-
Check the current status of SELinux:
# sestatus | grep "Current mode"
Current mode: permissive
To set SELinux back to "enforcing", run
# setenforce 1
-
-
Connect to a server via SSH.
-
Open the file
/etc/selinux/config
in any text editor. In this example, we are using the vi utility:# vi /etc/selinux/config
-
Change the
SELINUX
value to:-
disabled
to completely turn off SELinux on the server:CONFIG_TEXT: SELINUX=disabled
-
permissive
to make SELinux print warnings instead of enforce security policy:CONFIG_TEXT: SELINUX=permissive
-
enforcing
to make SELinux security policy enforced:CONFIG_TEXT: SELINUX=enforcing
-
-
Save the changes and close the file.
-
Restart the server to apply the changes.
-
Check the permanent status of SELinux:
# sestatus | grep "Mode from config file"
Mode from config file: permissive
Comments
0 comments
Please sign in to leave a comment.