sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
cat /etc/selinux/config
# 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
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
sed -i
是用于在原文件上直接进行修改的选项。
它的作用是将 sed
命令对文件内容的修改直接应用到原始文件中,而不是输出到新的文件或屏幕。
例如,sed -i '/old/new/g' file.txt
会将文件 file.txt
中的所有 old
替换为 new
。