1024programmer Linux How to close selinux-linux operation and maintenance

How to close selinux-linux operation and maintenance

How to close selinux?

Close selinux

1. Get the status of selinux through the command “getenforce”,

Recommended: “Linux Tutorial

[root@localhost ~]# getenforce
 Enforcing //enforcing means open,
 
 [root@localhost ~]# getenforce
 Permissive // ​​permissive means warning
 
 [root@localhost ~]# getenforce
 Disabled //disabled means off
 [root@localhost ~]#

2. You can close selinux by entering commands in the terminal. This method is only temporarily closed and has no effect after restarting

[root@localhost ~]# setenforce 0 //close
 [root@localhost ~]# getenforce
 Permissive
 
 [root@localhost ~]# setenforce 1 //Open
 [root@localhost ~]# getenforce
 Enforcing

3. Modify the selinux state through the configuration file “/etc/sysconfig/selinux”, this method needs to restart the machine

  [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. Close selinux by modifying “/boot/grub/menu.lst”, so that selinux will not be started every time you boot

[root@localhost ~]# gedit /boot/grub/menu.lst
 default=0
 timeout=5
 splashimage=(hd0,0)/grub/splash.xpm.gz
 hidden menu
 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 KEYBO ARDTYPE=pc  KEYTABLE=us rd_NO_DM rhgb quiet selinux=0
         initrd /initramfs-2.6.32-431.el6.i686.img

The above is the detailed content of how to close selinux, please pay attention to other related articles on 1024programmer.com for more information!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/how-to-close-selinux-linux-operation-and-maintenance-2/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索