switch_selinux.sh | 开启或禁用SELinux
switch_selinux.sh | 开启或禁用SELinux
#!/bin/bash
SELINUX_CFG="/etc/selinux/config"
uasge() {
echo "Usage: $0 on|off"
exit
}
main() {
case "$1" in
on)
sed -ri /^SELINUX=/'s/(SELINUX=).*/\1enforcing/' $SELINUX_CFG
;;
off)
sed -ri /^SELINUX=/'s/(SELINUX=).*/\1disabled/' $SELINUX_CFG
echo "you should reboot to make selinux enabled."
;;
*)
uasge
;;
esac
}
main $1
欢迎转载,转载请附原文链接 [ 邮箱:scm.scm.scm.163.com]