概述

由于需要开放telnet非默认端口,添加SElinux规则时报错。

[root@localhost ~]# semanage port -a -t telnetd_port_t -p tcp 23023
SELinux:  Could not downgrade policy file /etc/selinux/targeted/policy/policy.24, searching for an older version.
SELinux:  Could not open policy file <= /etc/selinux/targeted/policy/policy.24:  No such file or directory
libsemanage.semanage_reload_policy: load_policy returned error code 2.
SELinux:  Could not downgrade policy file /etc/selinux/targeted/policy/policy.24, searching for an older version.
SELinux:  Could not open policy file <= /etc/selinux/targeted/policy/policy.24:  No such file or directory
libsemanage.semanage_reload_policy: load_policy returned error code 2.
/usr/sbin/semanage: 无法提交 semanage 事务

处理办法

由于semanage命令添加操作是需要SElinux处于开启状态,在关闭状态是无法进行操作的。

[root@localhost ~]# sestatus
SELinux status:                 disabled
[root@localhost ~]# getenforce
Disabled
# 部分文件位置:/etc/sysconfig/selinux
[root@localhost ~]# sudo vi /etc/selinux/config
SELINUX=enforcing

分类: Linux