This article introduces how to enable/disable SELinux permissions in the open-source OpenHarmony system,demonstrated on the Tactile Intelligence Purple Pi OH development board, which is equipped with the Rockchip RK3566 chip, designed like a Raspberry Pi, recommended by the Laval official community, and has adapted to the new OpenHarmony 5.0 Release system!
SELinux Permission Status
SELinux has a total of 3 states: Enforcing, Permissive, and Disabled.
Enforcing: Mandatory mode, actions violating SELinux rules will be blocked and logged.
Permissive: Tolerant mode, actions violating SELinux rules will only be logged, generally for debugging.
Disabled: SELinux permissions are turned off.
To check SELinux permissions, use the command below:
C:\\Users\\industio>hdc shell//Check SELinux permissions status# getenforce//In this state, SELinux permissions are enabled in Enforcing mode
//Temporarily disable SELinux permissions# setenforce 0# getenforcePermissive
-
Method 1
The path of the SELinux config file in the OpenHarmony system is
system/etc/selinux/config
, as shown in the figure below:Use the hdc command to drag the file to your local machine, the command is as follows:
C:\\Users\\industio>hdc shell mount -o remount,rw /C:\\Users\\industio>hdc file recv system/etc/selinux/config "local path"
After modifying the SELinux permission status in the local config file, push the file back to the system
C:\\Users\\industio>hdc file send "local path" system/etc/selinux/FileTransfer finish, Size:624, File count = 1, time:30ms rate:20.80kB/s
-
Method 2
Modify the SELinux permission path in the SDK:
/base/security/selinux_adapter/selinux.gni
, as shown in the figure below:The command is as follows:
declare_args() {//Modify permissions as needed, currently in enabled state. Change true to false to disable selinux_enforce = true }
After modifying, save and exit, and recompile the entire SDK.
-
Supports OpenHarmony/Android/Linux multiple operating systems, compatible with Raspberry Pi pin headers; -
Rockchip RK3566 chip, quad-core A55 processor, 1.8GHz frequency, Mali G52-2EE GPU; -
Supports OpenGL/CL/Vulkan, 8M ISP; -
1T computing power NPU, supports TensorFlow/Caffe/ MXNet/PyTorch and other deep learning frameworks; -
Supports 1 x Gigabit Ethernet, 3 x USB2.0 1 x USB3.0, 3 x UART, 2 x SPI 2 x I2C, 28 x GPIO, 1 x MIPI DSI 1 x MIPI CSI, 1 x HDMI; -
First to support OpenHarmony 5.0/4.1/4.0/ 3.2, open SDK source code, 3D printed shell; -
Active developer community, more experts online for interaction and technical support; -
Super small size, extreme cost performance, only 249 yuan;
Leave a Comment
Your email address will not be published. Required fields are marked *