關閉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 LANG=zh_CN.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 |