1. 基本
ls -Z
命令:getenforce
- enforcing 强制
- permissive 警告
- disabled 关闭selinux
命令:setenforce [0|1]
0:转成 permissive 宽容模式;
1:转成 Enforcing 强制模式;
vim /etc/sysconfig/selinux
修改 SELINUX=disabled
reboot
yum -y install policycoreutils-python
选项 含义
-a 添加默认安全上下文配置
-d 删除指定的默认安全上下文
-m 修改指定的默认安全上下文
-t 设定默认安全上下文的类型
semanage fcontext -a -t system_cron_spool_t "/test(/.*)?"
restorecon -FRv /test/
ls -Zd /test/
2. 端口操作
semanage port -l
semanage port -l | grep http
semanage port -a -t http_port_t -p tcp 8909
3. 实例
[root@servera ~]
[root@servera ~]
[root@servera ~]
[root@servera ~]
Listen 82
[root@servera ~]
[root@servera ~]
[root@servera ~]
[root@servera ~]
tcp6 0 0 :::82 :::* LISTEN
25747/httpd
[root@servera ~]