I have an Android TV box (4.4.2, armv7), and I can login the device as root by ADB (local network). What I want to do is to give certain apps root permission. How can I do it?
1 Answers
You don't give certain apps root permission, but certain apps ask for root permission by executing su
binary. It's the developer of the app who decides if the app would perform some tasks with root privileges or not. In order to let apps request root privileges, you need to root your device using e.g. Magisk, SuperSU etc. (whatever works on your device).
When you get root privileges on adb
(e.g. by executing adb root
or adb shell su
) it runs adbd
process on device as root (UID 0
) user. So all commands which you run through adb
have root privileges. To grant root access to apps you need a special su
binary which is not shipped with Android.
The usual su
binary (like on any UNIX-like OS) makes a transition to UID 0
by making setuid
syscall to kernel. This is not possible on Android due to certain restrictions. The special su
binary (the one provided by rooting solutions like Magisk) connects to a background daemon to get a root shell for the requesting app, where the app can execute commands with root privileges. However the app itself is still running with its own UID (assigned at the time of installation).
For more details see:

- 20,353
- 3
- 70
- 213
su
which's location is/system/xbin
and I runchmod 777
to this file. Then I install supersu on the box but it remind "su binary occupied". So do I have a solution to solve it? – punnpkin May 24 '20 at 09:30su
binary already provided in Android cannot be used with SuperSU. They provide their ownsu
binaries. That's what I tried to explain in the answer. For more details see linked answers. – Irfan Latif May 24 '20 at 09:36adb root
and you run have root privs, why can't you run the app? That doesn't make sense, you grant root access to anything root runs. Why can't someone with root access run an android app? – Evan Carroll Jul 18 '22 at 04:04