This project provides a Magisk/KernelSU module for rooted Android devices that sets the system's SELinux mode to "Permissive" upon booting.
The module utilizes a simple shell script (service.sh
) that runs during the boot process. Once the device has finished booting, this script executes the command setenforce 0
(or setenforce permissive
) to change the SELinux status from "Enforcing" to "Permissive".
- Sets SELinux to Permissive on boot.
- Lightweight: No native binaries, relies on a simple shell script.
- Compatible with Magisk, KernelSU and APatch (KSU and APatch need zygisk-next or similar).
- A rooted Android device.
- Magisk (v20.4+), KernelSU or APatch installed.
- If using KSU or APatch then you need some form of zygisk implementation (like zygisk-next for example).
- Clone this repository.
- Ensure you have the Android SDK and NDK configured if you intend to modify the Gradle build scripts (though not strictly necessary for just building the existing setup).
- Navigate to the project's root directory in your terminal.
- Execute the Gradle wrapper command to build the module. For a release version:
Or, if you want to build and immediately attempt to push and install via KernelSU (assuming
./gradlew assembleRelease
adb
is set up and a device/emulator is connected):Similarly for Magisk (though the specific task might be./gradlew installKsuRelease
installMagiskRelease
- checkmodule/build.gradle.kts
for exact task names):./gradlew installMagiskRelease
- The flashable module ZIP file will be located in
module/release/
. The filename will be similar toMagisk-SElinux-Permissive-vX-Y-commit-release.zip
.
- Build the module (see above) or download a pre-built ZIP from the releases page.
- Transfer the generated
.zip
file to your Android device. - Open your Magisk Manager or KernelSU app.
- Navigate to the "Modules" section.
- Tap on "Install from storage" (or a similar option) and select the module's ZIP file.
- Reboot your device when prompted.
After rebooting, SELinux should be in "Permissive" mode. You can verify this by opening a terminal app on your device and running the command getenforce
. It should return Permissive
.
A simpler way is to look inside the Magisk or KSU app. The home page contains the enforcement status of SElinux.
Modifying system configurations like SELinux can have security implications. Use this module at your own risk. Ensure you understand what SELinux is and why you need to set it to permissive before using this module.