CentOS7中關閉selinux
在安裝Cobbler和Puppet時需要關閉selinux,但是通常情況下載安裝完CentOS7後,預設情況下SElinux是啟用狀態,
如下所示:
[csharp]view plaincopy
- [root@rdo~]#sestatus
- SELinuxstatus:enabled
- SELinuxfsmount:/sys/fs/selinux
- SELinuxrootdirectory:/etc/selinux
- Loadedpolicyname:targeted
- Currentmode:enforcing
- Modefromconfigfile:enforcing
- PolicyMLSstatus:enabled
- Policydeny_unknownstatus:allowed
- Maxkernelpolicyversion:28
1、如果要臨時關閉,可以執行
[cpp]view plaincopy
- setenforce0
此時的狀態如下
[html]view plaincopy
- [root@rdo~]#sestatus
- SELinuxstatus:enabled
- SELinuxfsmount:/sys/fs/selinux
- SELinuxrootdirectory:/etc/selinux
- Loadedpolicyname:targeted
- Currentmode:permissive
- Modefromconfigfile:enforcing
- PolicyMLSstatus:enabled
- Policydeny_unknownstatus:allowed
- Maxkernelpolicyversion:28
2、如果要永久關閉,可以修改設定檔/etc/selinux/config,將SELINU置為disabled。[html]view plaincopy
- [root@rdo~]#cat/etc/selinux/config
- #ThisfilecontrolsthestateofSELinuxonthesystem.
- #SELINUX=cantakeoneofthesethreevalues:
- #enforcing-SELinuxsecuritypolicyisenforced.
- #permissive-SELinuxprintswarningsinsteadofenforcing.
- #disabled-NoSELinuxpolicyisloaded.
- #SELINUX=enforcing
- SELINUX=disabled
- #SELINUXTYPE=cantakeoneofthreetwovalues:
- #targeted-Targetedprocessesareprotected,
- #minimum-Modificationoftargetedpolicy.Onlyselectedprocessesareprotected.
- #mls-MultiLevelSecurityprotection.
- SELINUXTYPE=targeted
修改該設定檔也可以執行下面的命令來完成[html]view plaincopy
- sed-i'/SELINUX/s/enforcing/disabled/'/etc/selinux/config
修改完成後,儲存重啟,重啟後狀態如下:
[html]view plaincopy
- [root@rdo~]#sestatus
- SELinuxstatus:disabled