Linux伺服器---關閉selinux

一生有你llx發表於2018-11-19

關閉selinux

1 、通過命令“getenforce”獲取selinux狀態,

[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

 



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29270124/viewspace-2220512/,如需轉載,請註明出處,否則將追究法律責任。

相關文章