}
查看: 8|回覆: 0

CentOS 7 開啟/關閉SELinux

[複製鏈接]

0

主題

0

回帖

2

積分

管理員

積分
2
發表於 2020-12-7 18:01:22 | 顯示全部樓層 |閲讀模式
Step 1
確認SELinux是否被啟動
SELinux停止運作狀態



[andy@www ~]$ sudo sestatus
SELinux status:           disabled






SELinux正常運作狀態


[andy@www ~]# sudo sestatus
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 21
Policy from config file:        targeted


---------------------------------
STEP 2
暫時停止SELinux
(重開機之後,會恢復原始設定)
[andy@www ~]$ sudo setenforce 0


STEP 3
andy@www ~]$ sudo vim /etc/selinux/config







# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted







永久停止SELinux:將第6行改為SELINUX=disable
永久啟用SELinux:將第6行改為SELINUX=enable
下次重開機時就會套用設定檔的設定值了


您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

關注公眾號

相關侵權、舉報、投訴及建議等,請發 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版發帖
關注公眾號
返回頂部