Skip to content

Instantly share code, notes, and snippets.

@AlvaroBrey
Last active March 1, 2019 19:21
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save AlvaroBrey/83d90a6a156790e06b8789447d273ace to your computer and use it in GitHub Desktop.
Save AlvaroBrey/83d90a6a156790e06b8789447d273ace to your computer and use it in GitHub Desktop.
Authorize ADB for a non-booting device
#!/usr/bin/env bash
adb shell 'echo "persist.service.adb.enable=1" >> default.prop'
adb shell 'echo "persist.service.debuggable=1" >> default.prop'
adb shell 'echo "persist.sys.usb.config=mtp,adb" >> default.prop'
adb shell 'echo "persist.service.adb.enable=1" >> /system/build.prop'
adb shell 'echo "persist.service.debuggable=1" >> /system/build.prop'
adb shell 'echo "persist.sys.usb.config=mtp,adb" >> /system/build.prop'
adb push ~/.android/adbkey.pub /data/misc/adb/adb_keys
@AlvaroBrey
Copy link
Author

AlvaroBrey commented Aug 6, 2017

  1. Reboot to TWRP
  2. Mount /system
  3. Execute this script

@timea-techgirl
Copy link

How to execute this through twrp on a phone with broken screen? Do I have to create a flashable zip or is there an adb command through twrp to execute shell scripts?

@AlvaroBrey
Copy link
Author

AlvaroBrey commented Nov 21, 2017

@malitech You will need to mount /system through adb shell, but this script executed in your computer.

@calebcabob
Copy link

@ontherunvaro Great stuff dude, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment