首頁  >  文章  >  運維  >  怎麼關閉selinux

怎麼關閉selinux

藏色散人
藏色散人原創
2020-05-29 11:43:406161瀏覽

怎麼關閉selinux

怎麼關閉selinux?

關閉selinux

1、透過指令「getenforce」取得selinux狀態,

推薦:《linux教程

[root@localhost ~]# getenforce
Enforcing        //enforceing代表开启,
 
[root@localhost ~]# getenforce
Permissive      // permissive代表警告
 
[root@localhost ~]# getenforce
Disabled        //disabled代表关闭
[root@localhost ~]#

2、在終端機輸入命令即可關閉selinux,此種做法只是暫時關閉,重啟之後沒有效果

[root@localhost ~]# setenforce 0    //关闭
[root@localhost ~]# getenforce
Permissive         
 
[root@localhost ~]# setenforce 1    //开启
[root@localhost ~]# getenforce
Enforcing

3、透過設定檔“ /etc/sysconfig/selinux」來修改selinux狀態,此種做法需要重新啟動機器

[root@localhost ~]# gedit /etc/sysconfig/selinux 
# 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

4、透過修改「/boot/grub/menu.lst」來關閉selinux,這樣每次開機都不會啟動selinux

[root@localhost ~]# gedit /boot/grub/menu.lst 
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-431.el6.i686)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-431.el6.i686 ro root=/dev/mapper/VolGroup-lv_root nomodeset rd_NO_LUKS rd_NO_MD rd_LVM_LV=VolGroup/lv_swap crashkernel=auto vga=ask.UTF-8 rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet selinux=0
        initrd /initramfs-2.6.32-431.el6.i686.img

以上是怎麼關閉selinux的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn