linux中selinux参数,初见shell,设置SElinux参数

关闭SElinux应该用用户输入变量做替换,不过这样也好。

==========================================

#!bin/bash

clear

echo "--------------------"

echo -e " \033[34mThis file controls the state of SELinux on the system.\033[0m"

echo -e "\033[33m SELINUX\033[0m = can take one of these three values:"

echo -e "     \033[4me\033[0mnforcing - SELinux security policy is enforced."

echo -e "     \033[4mp\033[0mermissive - SELinux prints warnings instead of enforcing."

echo -e "     \033[4md\033[0misabled - No SELinux policy is loaded."

echo -e " \033[33mSELINUXTYPE\033[0m = can take one of these two values:"

echo -e "     \033[4mt\033[0margeted - Targeted processes are protected,"

echo -e "     \033[4mm\033[0mls - Multi Level Security protection."

echo "--------------------"

echo "Select SElinux mode(e,p,d):"

while :

do

read sel

case $sel in

"e" | "E")

selt="SELINUX=enforcig"

break

;;

"p" | "P")

selt="SELINUX=permissive"

break

;;

"d" | "D")

selt="SELINUX=disabled"

break

;;

*)

echo "Re input"

;;

esac

done

echo "Select SElinuxtype mode(t,m):"

while :

do

read sele

case $sele in

"t" | "T")

selet="SELINUXTYPE=targeted"

break

;;

"m" | "M")

selet="SELINUX=mls"

break

;;

*)

echo "Re input"

;;

esac

done

echo "Press any key to continue...  (Ctrl+c to Exit)"

read -n 1

echo "#SELINUX=enforcig/permissive/disabled" > /etc/sysconfig/selinux

echo $selt >> /etc/sysconfig/selinux

echo "#SELINUX=tmargeted/mls" >> /etc/sysconfig/selinux

echo $selet >> /etc/sysconfig/selinux

echo "------------------------"

sed -n '2p' /etc/sysconfig/selinux

sed -n '4p' /etc/sysconfig/selinux

echo "------------------------"

========================================================

不效率。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值