Alex4SSB / ADB-Explorer

A fluent UI for ADB on Windows
MIT License
400 stars 33 forks source link

Add support for shell root #165

Closed GunjanSkry closed 1 year ago

GunjanSkry commented 1 year ago

Unable to get root access on Android 11 getting the following status on root enable -> [ Root Access: Status Forbidden ].

GunjanSkry commented 1 year ago

It seems that adb shell can get root access. https://stackoverflow.com/a/73257890

Alex4SSB commented 1 year ago

So if you try

adb shell
su

it works on your phone? Because that doesn't work for me on multiple devices

Ok, I got it working on an emulator

Alex4SSB commented 1 year ago

Since we do not use shell ls, there is no point in using shell root

GunjanSkry commented 1 year ago

So if you try

adb shell
su

it works on your phone? Because that doesn't work for me on multiple devices

Ok, I got it working on an emulator

Sorry for the late reply, yes it works on any magisk rooted phone. Since adb root is not allowed after Android 10, apparently this is the only way to get root access.

So what I was trying to do is that I wanted to copy app data into data/data dir in my device but in order to do so you need root I looked at your code and I found that you are using adb root to get access. Now my device is running on Android 11 so it does not work.

I solution that I looked at was that you first copy to temp location on phone using adb push and then using adb shell, su you will get root access now you can copy the data from temp location to wherever you want in side root of the device. Hope I was clear in my explanation.

Also if anyone came across this issue, one can try this https://liwugang.github.io/2021/07/11/magisk_enable_adbr_root.html

Alex4SSB commented 1 year ago

One of the devices I test with is OnePlus 3T with LineageOS Android 11. On this phone, adb root works for me, but running su in shell gives me: /system/bin/sh: su: inaccessible or not found

I also tested this on an emulator - API 32 (Android 12) with no Google Play. On it, both adb root and shell su are working.

As I mentioned before, we use adb ls to get folder structure. And as it cannot benefit from shell su, I do not see the point in adding it. Switching to shell ls is highly discouraged as it wasn't really built for parsing, and has inconsistent behavior across devices.

If you think this is a useful addition specifically for your case, we can discuss adding a non-global feature for that (like copy as root / push as root). But then again, you probably wouldn't be able to see those files in the destination.