![如何在 CentOS 中删除 SELinux 模块?](https://linux22.com/image/696643/%E5%A6%82%E4%BD%95%E5%9C%A8%20CentOS%20%E4%B8%AD%E5%88%A0%E9%99%A4%20SELinux%20%E6%A8%A1%E5%9D%97%EF%BC%9F.png)
我试过了但是出现了错误。
# ls -l opendkim.pp
-rw-r--r--. 1 root root 1569 Jan 8 01:20 opendkim.pp
# ls -l /etc/selinux/targeted/modules/active/modules/opendkim.pp
-rw-r--r--. 1 root root 344 Jan 8 01:33 /etc/selinux/targeted/modules/active/modules/opendkim.pp
# semodule -r opendkim.pp
SELinux: Could not load policy file /etc/selinux/targeted/policy/policy.24: Invalid argument
/sbin/load_policy: Can't load policy: Invalid argument
libsemanage.semanage_reload_policy: load_policy returned error code 2.
SELinux: Could not load policy file /etc/selinux/targeted/policy/policy.24: Invalid argument
/sbin/load_policy: Can't load policy: Invalid argument
libsemanage.semanage_reload_policy: load_policy returned error code 2.
semodule: Failed!
# ls -lZ /etc/selinux/targeted/policy/policy.24
-rw-r--r--. root root unconfined_u:object_r:semanage_store_t:s0 /etc/selinux/targeted/policy/policy.24
为什么要花 5 个月以上才会失败?
CentOS 版本 6.8(最终版)
答案1
semodule -r
需要模块名称,而不是文件名。
因此它将会是这样的:
semodule -r opendkim
或者您在定义模块时赋予它的任何名称。