Rootop 服务器运维与web架构

shell脚本关闭selinux

| 暂无评论

#!/bin/bash
CHECK=$(grep SELINUX= /etc/selinux/config | grep -v "#")
if [ "$CHECK" == "SELINUX=enforcing" ]; then
        sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
        setenforce 0
fi
        if [ "$CHECK" == "SELINUX=permissive" ]; then
                sed -i 's/SELINUX=permissive/SELINUX=disabled/g' /etc/selinux/config
                setenforce 0
        fi

                if [ "$CHECK" == "SELINUX=disabled" ]; then
                        exit
                fi
exit

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/2307.html

作者:Venus

服务器运维与性能优化

发表回复