Manage USB debugging authorizations #60

Open
opened 2026-01-27 18:36:02 +01:00 by Benjamin_Loison · 0 comments

DuckDuckGo and Google search ADB list "USB debugging authorizations".

Would help Benjamin_Loison/Backup_Android_apps/issues/76.

As I trust both my Linux Mint 22.3 Cinnamon Framework 13 and Debian 13 GNOME Pegasus to have adb access to my Fairphone 4 LineageOS 23.0.

cd /data/misc/adb/
/system/bin/sh: cd: /data/misc/adb: Permission denied

issues/59#issue-1786 and issues/41#issue-1687 android.security.authorization may help.

adb root
restarting adbd as root

adb_keys correctly mentions benjamin_loison@pegasus and benjamin_loison@benjamin-loison-framework.

#43 may help.

I confirm adb_keys being as ~/.android/adbkey.pub just with the hostname in the former.

file adb_temp_keys.xml                                                                                               
adb_temp_keys.xml: Android Binary XML v0
axmldec
axmldec: command not found

ytsutano/axmldec has 242 stars and last commit was 9 years ago.

DuckDuckGo and Google search Android Binary XML decoder and Android Binary XML encoder.

androguard/axml has 11 stars and last commit was 4 months ago.

apk-editor/aXML has 49 stars and last commit was today.

It does not seem to propose a CLI tool.

hzw1199/xml2axml has 284 stars and last commit was 6 years ago.

The Stack Overflow answer 11377073 seems specific to AndroidManifest.xml and quite complex.

l741589/xml2axml has 21 stars and last commit was 9 years ago.

If just remove from adb_keys, then adb shell prompt on the phone to verify the fingerprint as usually and accepting gives adb shell access.

However, to add a device, is it enough?

xgouchet/AXML has 124 stars and last commit was 9 years ago.

iBotPeaches/Apktool has 23.8k stars and last commit was last week.

https://apktool.org/wiki/the-basics/intro
https://apktool.org/wiki/the-basics/decoding

do not seem to help.

androguard/androguard has 5.9k stars and last commit was 2 weeks ago.

What up-to-date open-source command line provides the ability to decode and recode Android binary XML?

Mistral output:

As of early 2026, the most up-to-date and widely used open-source command line tools for decoding and recoding Android binary XML (AXML) are:

  • axmldec: A stand-alone, fast, and lightweight tool written in C++ that specializes in decoding binary AndroidManifest.xml files. It can also extract the decoded XML directly from an APK file and is suitable for batch processing and scripting.

  • xml2axml: A Java-based tool (provided as a JAR) that can both decode AXML to XML and encode XML back to AXML format. This is useful if you need to modify and repack Android resources.

  • Apktool: A comprehensive tool for reverse engineering Android APKs, including decoding and recoding binary XML files. It is widely used for both decompilation and recompilation of APKs, supporting all Android binary XMLs (AndroidManifest, layouts, resources, etc.).

  • Androguard: A Python-based toolkit that includes utilities for decoding Android binary XML files, with support for both command-line and programmatic use.

  • AXML (xgouchet/AXML): A dedicated Android binary XML file parser, useful for programmatic access and integration into custom tools.

Summary Table:

Open-Source Tools for Android Binary XML

Tool Decode Recode Language Notes
axmldec Yes No C++ Fast, CLI, good for batch processing
xml2axml Yes Yes Java JAR, supports both directions
Apktool Yes Yes Java Full APK reverse engineering
Androguard Yes No Python Programmatic, part of a larger toolkit
AXML Yes No (Library) Parser for integration

If you need both decoding and recoding, xml2axml and Apktool are your best options. For fast, lightweight decoding, axmldec is ideal. Would you like more details on how to use a specific tool?

https://chatgpt.com/share/6978ee5c-7730-8002-8ad7-28e6f42315cd

MadSquirrels/mobile/pyaxml has 3 stars and last commit was last month.

https://androguard.readthedocs.io/en/latest/intro/axml.html

I started suspecting that can't decode any binary file.

hzw1199/xml2axml/releases/download/1.1.0/xml2axml-1.1.0-SNAPSHOT.jar was published on 19/03/2020.

It is unclear how to compile.

java -jar xml2axml-1.1.0-SNAPSHOT.jar d a
Output:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2
	at com.bigzhao.xml2axml.test.Main.main(Main.java:21)

https://chat.mistral.ai/chat/e4fb8974-cdf8-4f9e-83f5-96403cb22207

On LineageOS how to remove a single USB debugging authorization with adb?

Output:

On LineageOS (and Android in general), USB debugging authorizations are stored in ~/.android/adbkey.pub on your computer and in /data/misc/adb/adb_keys on your device. However, there is no built-in ADB command to remove a single authorization—you can only revoke all authorizations at once.

How to Remove All USB Debugging Authorizations

If you want to revoke all USB debugging authorizations (not just one), you can do this:

On the Device:

  1. Go to Settings > System > Developer options.
  2. Tap Revoke USB debugging authorizations.
    • This clears all previously authorized computers.

On the Computer:

  1. Delete the adbkey and adbkey.pub files in:
    • Linux/macOS: ~/.android/
    • Windows: %USERPROFILE%\.android\
  2. Restart the ADB server:
    adb kill-server && adb start-server
    

Removing a Single Authorization (Advanced)

If you must remove just one authorization (e.g., for a specific computer), you need to manually edit the adb_keys file on the device:

Steps:

  1. Root access required: You need a rooted device or a custom recovery (like TWRP) to access /data/misc/adb/adb_keys.
  2. Pull the file:
    adb pull /data/misc/adb/adb_keys
    
  3. Edit the file: Open adb_keys in a text editor and remove the line corresponding to the unwanted key.
  4. Push it back:
    adb push adb_keys /data/misc/adb/adb_keys
    
  5. Restart ADB:
    adb kill-server && adb start-server
    

Note:

  • This method requires root access and is not officially supported.
  • If you don’t have root, the only way is to revoke all authorizations and re-authorize trusted devices.

Would you like help with any of these steps?

https://chatgpt.com/share/6978f255-0e58-8002-8006-1a3471e6b14e

adb revoke
adb: unknown command revoke
adb devices --help
adb: adb devices [-l]
adb devices -h
adb: adb devices [-l]
adb devices -l
Output:
List of devices attached
XXXXXXXX               device usb:3-2 product:FP4eea model:FP4 device:FP4 transport_id:8
DuckDuckGo and Google search `ADB list "USB debugging authorizations"`. Would help [Benjamin_Loison/Backup_Android_apps/issues/76](https://codeberg.org/Benjamin_Loison/Backup_Android_apps/issues/76). As I trust both my Linux Mint 22.3 Cinnamon Framework 13 and Debian 13 GNOME Pegasus to have `adb` access to my Fairphone 4 LineageOS 23.0. ``` cd /data/misc/adb/ ``` ``` /system/bin/sh: cd: /data/misc/adb: Permission denied ``` [issues/59#issue-1786](https://gitea.lemnoslife.com/Benjamin_Loison/adb/issues/59#issue-1786) and [issues/41#issue-1687](https://gitea.lemnoslife.com/Benjamin_Loison/adb/issues/41#issue-1687) `android.security.authorization` may help. ``` adb root ``` ``` restarting adbd as root ``` `adb_keys` correctly mentions `benjamin_loison@pegasus` and `benjamin_loison@benjamin-loison-framework`. #43 may help. I confirm `adb_keys` being as `~/.android/adbkey.pub` just with the hostname in the former. ``` file adb_temp_keys.xml ``` ``` adb_temp_keys.xml: Android Binary XML v0 ``` ``` axmldec ``` ``` axmldec: command not found ``` [ytsutano/axmldec](https://github.com/ytsutano/axmldec) has 242 stars and last commit was 9 years ago. DuckDuckGo and Google search *Android Binary XML decoder* and *Android Binary XML encoder*. [androguard/axml](https://github.com/androguard/axml) has 11 stars and last commit was 4 months ago. [apk-editor/aXML](https://github.com/apk-editor/aXML) has 49 stars and last commit was today. It does not seem to propose a CLI tool. [hzw1199/xml2axml](https://github.com/hzw1199/xml2axml) has 284 stars and last commit was 6 years ago. [The Stack Overflow answer 11377073](https://stackoverflow.com/a/11377073) seems specific to `AndroidManifest.xml` and quite complex. [l741589/xml2axml](https://github.com/l741589/xml2axml) has 21 stars and last commit was 9 years ago. If just remove from `adb_keys`, then `adb shell` prompt on the phone to verify the fingerprint as usually and accepting gives `adb shell` access. However, to add a device, is it enough? [xgouchet/AXML](https://github.com/xgouchet/AXML) has 124 stars and last commit was 9 years ago. [iBotPeaches/Apktool](https://github.com/iBotPeaches/Apktool) has 23.8k stars and last commit was last week. https://apktool.org/wiki/the-basics/intro https://apktool.org/wiki/the-basics/decoding do not seem to help. [androguard/androguard](https://github.com/androguard/androguard) has 5.9k stars and last commit was 2 weeks ago. > What up-to-date open-source command line provides the ability to decode and recode Android binary XML? <details> <summary>Mistral output:</summary> > As of early 2026, the most up-to-date and widely used open-source command line tools for decoding and recoding Android binary XML (AXML) are: > > - **[axmldec](https://github.com/ytsutano/axmldec)**: A stand-alone, fast, and lightweight tool written in C++ that specializes in decoding binary AndroidManifest.xml files. It can also extract the decoded XML directly from an APK file and is suitable for batch processing and scripting. > > - **[xml2axml](https://stackoverflow.com/questions/29669937/android-converting-standard-xml-to-android-binary-xml-format-axml)**: A Java-based tool (provided as a JAR) that can both decode AXML to XML and encode XML back to AXML format. This is useful if you need to modify and repack Android resources. > > - **[Apktool](https://ibotpeaches.github.io/Apktool/)**: A comprehensive tool for reverse engineering Android APKs, including decoding and recoding binary XML files. It is widely used for both decompilation and recompilation of APKs, supporting all Android binary XMLs (AndroidManifest, layouts, resources, etc.). > > - **[Androguard](https://androguard.readthedocs.io/en/latest/intro/axml.html)**: A Python-based toolkit that includes utilities for decoding Android binary XML files, with support for both command-line and programmatic use. > > - **[AXML (xgouchet/AXML)](https://github.com/xgouchet/AXML)**: A dedicated Android binary XML file parser, useful for programmatic access and integration into custom tools. > > **Summary Table:** > > > Open-Source Tools for Android Binary XML > > > | Tool | Decode | Recode | Language | Notes | > |--------------|--------|--------|------------|----------------------------------------| > | axmldec | Yes | No | C++ | Fast, CLI, good for batch processing | > | xml2axml | Yes | Yes | Java | JAR, supports both directions | > | Apktool | Yes | Yes | Java | Full APK reverse engineering | > | Androguard | Yes | No | Python | Programmatic, part of a larger toolkit | > | AXML | Yes | No | (Library) | Parser for integration | > > If you need both decoding and recoding, **xml2axml** and **Apktool** are your best options. For fast, lightweight decoding, **axmldec** is ideal. Would you like more details on how to use a specific tool? </details> https://chatgpt.com/share/6978ee5c-7730-8002-8ad7-28e6f42315cd [MadSquirrels/mobile/pyaxml](https://gitlab.com/MadSquirrels/mobile/pyaxml) has 3 stars and last commit was last month. https://androguard.readthedocs.io/en/latest/intro/axml.html I started suspecting that can't decode any binary file. [hzw1199/xml2axml/releases/download/1.1.0/xml2axml-1.1.0-SNAPSHOT.jar](https://github.com/hzw1199/xml2axml/releases/download/1.1.0/xml2axml-1.1.0-SNAPSHOT.jar) was published on 19/03/2020. It is unclear how to compile. ``` java -jar xml2axml-1.1.0-SNAPSHOT.jar d a ``` <details> <summary>Output:</summary> ``` Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2 at com.bigzhao.xml2axml.test.Main.main(Main.java:21) ``` </details> https://chat.mistral.ai/chat/e4fb8974-cdf8-4f9e-83f5-96403cb22207 > On LineageOS how to remove a single *USB debugging authorization* with `adb`? <details> <summary>Output:</summary> > On LineageOS (and Android in general), **USB debugging authorizations** are stored in `~/.android/adbkey.pub` on your computer and in `/data/misc/adb/adb_keys` on your device. However, **there is no built-in ADB command to remove a single authorization**—you can only revoke all authorizations at once. > > ### How to Remove All USB Debugging Authorizations > If you want to **revoke all** USB debugging authorizations (not just one), you can do this: > > #### **On the Device:** > 1. Go to **Settings > System > Developer options**. > 2. Tap **Revoke USB debugging authorizations**. > - This clears all previously authorized computers. > > #### **On the Computer:** > 1. Delete the `adbkey` and `adbkey.pub` files in: > - **Linux/macOS:** `~/.android/` > - **Windows:** `%USERPROFILE%\.android\` > 2. Restart the ADB server: > ```bash > adb kill-server && adb start-server > ``` > > --- > > ### **Removing a Single Authorization (Advanced)** > If you **must** remove just one authorization (e.g., for a specific computer), you need to manually edit the `adb_keys` file on the device: > > #### **Steps:** > 1. **Root access required**: You need a rooted device or a custom recovery (like TWRP) to access `/data/misc/adb/adb_keys`. > 2. **Pull the file**: > ```bash > adb pull /data/misc/adb/adb_keys > ``` > 3. **Edit the file**: Open `adb_keys` in a text editor and remove the line corresponding to the unwanted key. > 4. **Push it back**: > ```bash > adb push adb_keys /data/misc/adb/adb_keys > ``` > 5. **Restart ADB**: > ```bash > adb kill-server && adb start-server > ``` > > --- > > ### **Note:** > - This method requires **root access** and is not officially supported. > - If you don’t have root, the only way is to **revoke all authorizations** and re-authorize trusted devices. > > Would you like help with any of these steps? </details> https://chatgpt.com/share/6978f255-0e58-8002-8006-1a3471e6b14e ``` adb revoke ``` ``` adb: unknown command revoke ``` ``` adb devices --help ``` ``` adb: adb devices [-l] ``` ``` adb devices -h ``` ``` adb: adb devices [-l] ``` ``` adb devices -l ``` <details> <summary>Output:</summary> ``` List of devices attached XXXXXXXX device usb:3-2 product:FP4eea model:FP4 device:FP4 transport_id:8 ``` </details>
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/adb#60