SELinux 在 Redhat 及 CentOS 預設會開啟 SELinux, 要關閉 SELinux 可以用以下方法:
檢查 SELinux 的狀態
# getenforce
如果上面的結果是 Enforcing, 即 SELinux 正在執行; Permissive 是臨時關閉; 如果是 Disabled, 即已經關閉.
暫時關閉 SELinux
# setenforce 0
這樣會暫時關閉 SELinux, 無需重新開機, 但下次重新開機後 SELinux 會照常執行.
永久關閉 SELinux
開啟 /etc/sysconfig/selinux, 找到 SELINUX=enforcing, 替換為:
SELINUX=disabled
儲存檔案後重新啟動系統便會永久關閉 SELinux.