CentOS 7 在SELinux保护下安全打开端口

发布于 6 年前 作者 bupafengyu 2812 次浏览 最后一次编辑是 6 年前 来自 分享

CentOS 7 在SELinux保护下安全打开端口

firewall-cmd --permanent --zone=public --add-port=2201/tcp
success
firewall-cmd --reload
semanage port -a -t http_port_t -p tcp 2201

firewalld的关闭打开

http://bbs.itying.com/topic/5bd5d4460e525017c449479a

对于新手来说,linux的selinux困扰了一大批学员,开启后,导致文件权限修改不了等问题,下面就是关闭设置setlinux的方法

查看SELinux状态:

1、/usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态

SELinux status:                 enabled

2、getenforce                 ##也可以用这个命令检查

关闭SELinux:

1、临时关闭(不用重启机器):

setenforce 0                  ##设置SELinux 成为permissive模式
setenforce 1 设置SELinux 成为enforcing模式

2、修改配置文件需要重启机器:

修改/etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled
1 回复

正常关闭就可以了 配置太复杂

回到顶部