
這篇文章主要講解了“CentOS8禁用SELinux的教程”,文中的講解內(nèi)容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“CentOS8禁用SELinux的教程”吧!
創(chuàng)新互聯(lián)長期為1000+客戶提供的網(wǎng)站建設(shè)服務,團隊從業(yè)經(jīng)驗10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務;打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為懷仁企業(yè)提供專業(yè)的成都做網(wǎng)站、成都網(wǎng)站制作,懷仁網(wǎng)站改版等技術(shù)服務。擁有十年豐富建站經(jīng)驗和眾多成功案例,為您定制開發(fā)。
如何在CentOS 8上暫時禁用SELinux
在開始在CentOS 8上禁用SELinux之前,請務必先檢查SELinux的狀態(tài)。
為此,請運行以下 命令:
[root@localhost www.linuxidc.com]# sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: actual (secure) Max kernel policy version: 31

這表明SELinux已啟動并正在運行。
要暫時禁用SELinux,請運行 命令。
# setenforce 0
另外,您可以運行命令。
# setenforce Permissive
這些命令中的任何一個都將暫時禁用SELinux,直到下次重啟為止。
如何在CentOS 8上永久禁用SELinux
現(xiàn)在,讓我們看看如何永久禁用SELinux。 SElinux的配置文件位于 /etc/selinux/config。 因此,我們需要對該文件進行一些修改。
# vi /etc/selinux/config
將SELinux屬性設(shè)置為Disabled,如下所示:
# 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 these three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted

保存并退出配置文件,然后使用以下任何命令重新啟動CentOS 8 Linux系統(tǒng)。
# reboot # init 0 # telinit 0
現(xiàn)在,使用命令檢查SELinux的狀態(tài)。
[linuxidc@localhost www.linuxidc.com]$ sestatus SELinux status: disabled

SELinux是CentOS 8上非常關(guān)鍵的功能,有助于限制未經(jīng)授權(quán)的用戶訪問系統(tǒng)上的某些服務。
感謝各位的閱讀,以上就是“CentOS8禁用SELinux的教程”的內(nèi)容了,經(jīng)過本文的學習后,相信大家對CentOS8禁用SELinux的教程這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!