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

相关文章:

  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2021-12-29
猜你喜欢
  • 2022-12-23
  • 2021-06-30
  • 2022-12-23
  • 2021-12-23
  • 2021-08-26
  • 2021-12-09
  • 2022-12-23
相关资源
相似解决方案