12

I have a Galaxy s3 (I9300) that has a broken touch screen (display is fine). I therefore can not click the authorization dialog that pops up when I try to access the device via adb on any ROMs above Android 4.2 as they require authorization to access the device via adb.

On 4.2 and 4.3 of the stock ROMs, I am able to copy my ~/.android/adbkey.pub file from my machine to /data/misc/adb/adb_keys on the device via CWM recovery and gain access. I have tried this with LineageOS 14 which is on Android 7.1.1 and I still don't get access. I am wondering where the adb_keys file is located on android 7.1.1 so I can do the same.

0

1 Answer 1

7

Since Android 4.2 when public key authentication was added to ADB, up to latest release 10, there are only two possible locations for adb_keys on stock Android:

On the device, vendors public keys are installed at build time in /adb_keys. User-installed keys are stored in /data/misc/adb/adb_keys.

So is the case with Android 7.1.1:

static const char *key_paths[] = {
    "/adb_keys",
    "/data/misc/adb/adb_keys",
    NULL
};

First one is only found on userdebug/eng ROMs. Also on debuggable builds, you can set ro.adb.secure to 0 to "allow adbd to connect without authentication". However "user builds filter out PRODUCT_ADB_KEYS, so no /adb_keys will be included". (Source)

So the RSA public keys added to /data/misc/adb/adb_keys should work. Make sure proper ownership (system:shell), mode (0640) and SELinux label (u:object_r:adb_keys_file:s0) are set on the file and restart adbd after adding key(s). Also check correct line endings (use dos2unix) after adding key(s) and make sure the right private key pair is available to adb server on PC. Path is ~/.android/ on Linux and %userprofile%\.android\ on Windows, or add the key filename/directory to ADB_VENDOR_KEYS environment variable.


RELATED:

2
  • 2
    How do I apply a SELinux label to a file? semanage doesn't exist on Android, or at least my OnePlus 6.
    – Nowaker
    Commented Jul 12, 2021 at 5:50
  • 1
    @Nowaker use chcon. SELinux policy is not configurable on Android devices, unlike PCs. So there's no semanage. Commented Jul 12, 2021 at 8:44

You must log in to answer this question.

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