标签:模式 html def class systemctl 基础 isa cmd emctl
enforcing(强制)
permissive(宽松)
disabled(禁用)
与disabled模式相关的切换都需要重启
getenforce ----查看模式
临时切换:setenforce 1|0 (1-强制,0-宽松)
永久配置:/etc/selinux/config
yum -y install httpd
systemctl restart httpd
systemctl enable httpd(开机自启)
本机访问测试>>> firefox ip
firefox 172.25.0.11
书写网页文件:
/var/www/html (httpd默认网页文件路径)
index.html (httpd默认为网页名称)
FTP------文件传输协议
yum -y install vsftpd
systemctl restart vsftpd
systemctl enable vsftpd
本机访问测试: firefox ftp://ip
firefox ftp://172.25.0.11
FTP默认共享路径:
var/ftp
允许出站,过滤入站
firewalld服务基础
firewall-cmd firewall-config(图形)
--public 仅允许访问本机的sshd dhcp ping等少数几个服务
--trusted 允许任何访问
--block 阻塞任何来访请求(明确拒绝)
--drop 丢弃任何来访的数据包(没有回应,直接丢弃,节省资源)
默认区域(public): root用户可以修改
[root@server0 ~]# firewall-cmd --get-default-zone #查看默认区域
public
[root@server0 ~]# firewall-cmd --set-default-zone=block #修改默认区域
success
[root@server0 ~]# firewall-cmd --get-default-zone
block
数据包内容:源IP地址 目标IP地址 数据
public区域添加服务的协议
[root@server0 ~]# firewall-cmd --zone=public --list-all public (default, active) interfaces: eth0 sources: services: dhcpv6-client ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules:
[root@server0 ~]# firewall-cmd --zone=public --add-service=ftp success [root@server0 ~]# firewall-cmd --zone=public --add-service=http success [root@server0 ~]# firewall-cmd --zone=public --list-all public (default, active) interfaces: eth0 sources: services: dhcpv6-client ftp http ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules:
[root@desktop0 ~]# firefox 172.25.0.11
[root@desktop0 ~]# firefox ftp://172.25.0.11
防火墙实现永久策略:
--permanent(永久)
firewall-cmd --reload
[root@server0 ~]# firewall-cmd --permanent --zone=public --add-service=http success [root@server0 ~]# firewall-cmd --permanent --zone=public --add-service=ftp success [root@server0 ~]# firewall-cmd --reload success [root@server0 ~]# firewall-cmd --zone=public --list-all public (default, active) interfaces: eth0 sources: services: dhcpv6-client ftp http ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules:
标签:模式 html def class systemctl 基础 isa cmd emctl
原文地址:https://www.cnblogs.com/ray-mmss/p/9938673.html