关闭防火墙/Selinux
#!/usr/bin/bash
echo "
----------------------------------
关闭防火墙
关闭SELINUX
v1.0 by admin 2020/1/1
----------------------------------
"
read -p "是否关闭防火墙和SELINUX(y/n)" num
if [[ " ${mun}" == y ]];then
echo "正在关闭..."
else
exit
fi
#关闭sellinux
setenforce 0
sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
if [ $? -ne 0 ];then
echo "执行命令失败"
else
echo "SELINUX关闭成功"
fi
#关闭防火墙
systemctl stop firewalld
if [ $? -ne 0 ];then
echo "关闭防火墙失败"
else
echo "关闭防火墙成功"
fi
echo "-----------------------------"