使用三剑客之一---sed 可以灵活的替换配置文件的字符,如下面把 /etc/selinux/config 中的 SELINUX=enforcing 替换为 SELINUX=disabled |
[root@node-16 cephfs]# cat /etc/selinux/config # This file controls the state of SELinux on the system.
|
[root@node-16 cephfs]# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config |
[root@node-16 cephfs]# [root@node-16 cephfs]# 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 two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
[root@node-16 cephfs]# |
或者
[root@node-16 cephfs]# sed -i '6s#enforcing#disabled#g' /etc/selinux/config |
使用sed命令在线灵活的替换字符串
最新推荐文章于 2023-12-14 14:51:11 发布