I have a rooted system-as-root Samsung Device and I am trying to run an init service which runs custom.sh
script using u:r:su:s0
SELinux context.
# define service, use executable here if script not needed
service custom /system/bin/custom.sh
# don't start unless explicitly asked to
disabled
# Use `seclabel u:r:magisk:s0` to run with unrestricted SELinux context to avoid avc denials
# can also use "u:r:su:s0" on userdebug / eng builds if no Magisk.
# It's required if SELinux is enforcing and service needs access
# to some system resources not allowed by default sepolicy
seclabel u:r:su:s0
# start the service when boot is completed
on property:sys.boot_completed=1
# Use it to start the service
start custom
As per my understanding, the rules for transition from init
context to su
context is not defined so, I should get avc: denial
error.
But, I am getting permission denied error as following:
init: cannot execve('/system/bin/custom.sh'): Permission denied
I have checked the permission of custom.sh
file and it is as following:
-r-xr-xr-- 1 root root 153 2019-11-04 13:25 /system/custom.sh
Please suggest what is happening here and how can I fix it?