centos如何关闭selinux

Hey bro, we need to understand the issue of disabling SELinux in CentOS. There are two ways to delete: temporary deletion and permanent deletion.
First let's talk about the temporary shutdown. It's like turning off the TV before you go out and turning it on when you get home. Disabling SELinux for now means you don't care about it at the moment. After restarting the system, it should still follow the original rules. This method is suitable when you need to quickly adjust security policies, such as testing or temporary troubleshooting.
程序并不复杂。
Just use the command, setenforce 0. Once this thing is done, it will take effect immediately.然后,您可以使用 getenford 命令查看它是否返回到启用或禁用,然后您就会知道临时关闭是否成功。

但是请注意,即使暂时禁用SELinux,系统仍然会记录安全事件日志,但不会阻止您做任何事情。
As for turning it off permanently, it is equivalent to unplugging the TV and not using it at all. This trick is suitable for situations where SELinux is not needed for a long time.
操作有点复杂。
首先您需要打开配置文件。
This configuration file is called /etc/selinux/config. Use a text editor such as vi or vim to open this file: find the line SELINUX=enforcing or SELINUX=permissive and change it to SELINUX=disabled.
After making changes, save and exit, and then restart the system. After restarting, you can use the sestatus command to check. If the SELinux status tells you that it is disabled, it means that the permanent shutdown was successful.
However, I should remind you that turning off SELinux reduces the security of the system. To do this you really need to understand the risks involved.如果您想保留某些安全功能,可以将其设置为自愿模式,这意味着系统只会记录非法活动,而不会阻止您做任何事情。
This configuration method is similar to temporary shutdown, which is using the setenfor 0 command or modifying the configuration file.

centos下关闭selinux不重启的方法

嘿,伙计,SELinux 真让人头疼。
记得前年我在上海服务器上安装一个新软件的时候,那东西一直报错。
After a long search, I found out that it was SELinux that wouldn't let me move. Just do it temporarily. 不用重装系统真是太好了。

You do as I say, open the terminal, type sudosetenforce0, and press Enter. 就是这么简单。
SELinux 立即成为“默认模式”,不会阻止你做任何事情,但非法操作会被记录下来。
这个技巧救了我好几次。
For example, the last time I helped the company next door to install an Exchange server, the patch installation stuck. 我还暂时关闭了 SELinux 来修复它。

要确认它是否已关闭,请输入 getenforce 并查看输出是否为 Permissive。
如果你想完全关闭它,你必须在/etc/selinux/config中更改SELINUX=disabled,然后重新启动。
But whoever likes to do this restarting thing, anyway, I try not to touch it. 请记住,/etc/selinux/config 和 /etc/sysconfig/selinux 是在一起的,更改一个并更改另一个。

In short, if you use setenforce0 temporarily, if you want to permanently change the configuration file, a restart is necessary. This trick works best, I can't believe in anything else.