2

If an Android user debug build comes with adb root access by default, does it contain the su binary to achieve this?

If not, is it any different from rooting your phone?

3
  • 1
    adbd doesn't use su binary but latter is shipped with debug builds (if not explicitly removed by ROM developer). However this su is entitely different than the one we get when we root the device. Details here: What special privileges “/system/xbin/su” does have w.r.t. root access?. Also related: Why “adb root” does nothing? Commented Nov 3, 2020 at 18:26
  • So that explains why im seeing the su binary within the xbin directory. I was wondering what that was.So when a device becomes rooted using a conventional method like Magisk and grants an app root access, to run root shell commands, does it use the adb daemon to an extent? Commented Nov 4, 2020 at 14:53
  • Not at all. Magisk runs its own daemon. See How Magisk works? Commented Nov 4, 2020 at 16:24

2 Answers 2

3

No, adb does not require a su binary to get root permissions.

On a regular build, it is just the other way around: adbd is started by the Android system itself with root permissions. Up to a certain point, it uses these root permissions (open port and so on), and then adbd drops the root permissions.

On an Android user debug build, it comes with adb root access. adbd does not drop the root permissions, hence every command executed via adb is also executed with root permissions.

2
  • So when someone "roots" their device using the su binary , does it just enable them to run adbd using root permissions? And does the using su binary provide root permissions anywhere else that a userdebug build does not? Commented Nov 3, 2020 at 17:26
  • 1
    @RameshJoshi adbd and su are totally independent from each other. Each of them does not use the other on it's own. On a rooted device (where adbddoes not run in root mode) however you can inside the shell provided via adb (adb shell) execute commands with root permissions via su but that is a different topic because in this case you as the user use su, the adb shell is just the "stage" you are working on.
    – Robert
    Commented Nov 3, 2020 at 17:36
1

I just built a userdebug version of AOSP 10.0 for my Pixel 4 XL; it does contain an su binary in /system/xbin/su.

It differs from what many mean by "rooting" in that it doesn't let you actually run su from on the phone itself (say, within Termux). It can only be executed by root or a member of the shell group, which is what is used while running an adb shell session. However, it still is a way to run things as root; it merely requires an adb connection to do so. If your USB cable doesn't carry data or your USB port is broken/faulty, you wouldn't be able to run things as root anymore (unless you had already set up adb on the device to run over TCP).

I later put Magisk on my otherwise-AOSP ROM and now have two su binaries; the Magisk one is installed in /sbin/su. Magisk's /sbin/su will let me run things as root without an adb connection active.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .