Android permission allowed adb shell

I suffered while using adb.exe .

I wanted to use the adb.exe shell adb.exe in the same way as bash, so I decided to change the default binary to bash (of course, the binary was compiled and everything was perfect)

change bash binary order below

  • adb remount
  • adb push bash /system/bin/

  • adb shell

  • cd /system/bin
  • chmod 777 bash
  • mv sh sh.bak
  • ln -s bash sh

The first change was successful, but the problem occurs when the second attempt.

I click on the new bash binary code, but I missed changing the bash resolution of 777 and disabled adb shell .

after

 C:\Program Files (x86)\Android\android-sdk\platform-tools>adb.exe shell - exec '/system/bin/sh' failed: Permission denied (13) - C:\Program Files (x86)\Android\android-sdk\platform-tools> 

Is there a smart idea to fix this resolution problem?

Please help me...

+6
source share
3 answers

If the device does not crash completely (/ system / bin / sh is a dependency for many things, rebooting may not go very far!), And the system partition is still writable, you can use adb push a new copy of bash, where you must install permission bits optionally in the host system before pressing it (you may have to use cygwin or even linux to have permission bits locally)

It looks like the device is rooted, so you can configure or configure the terminal emulator application to give you a session using the sh backup, run the sh backup again as root using some escalation tool, and then fix the problem.

If you have a modified recovery using adb, you could fix it from there by manually installing the (regular) system partition.

The last help will be restored from the image signed by the vendor.

I hope you get awkward, but you may have learned from this experience . Changing the default shell is probably not a good idea. It would be better to load your own shell under a different name and run it manually.

+1
source

A common solution for such tasks: removing the system application and all.

 adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblk4 /system cd /system/app/ rm maps.apk mount -o ro,remount -t yaffs2 /dev/block/mtdblk4 /system sync reboot 
+1
source

If you have the latest versions of CWM installed, you can save

a) restore reboot adb (boot your phone to recovery)

b) in CWM, restore the mount / system partition (using your phone).

c) adb kill-server

d) sudo adb start-server

e) adb shell

f) Did you correctly determine your permission

I was influenced by the answer here https://android.stackexchange.com/questions/38085/is-it-a-hard-brick/113507#113507?newreg=6e0c0c0be98349058d3e1668532cd7dc

0
source

Source: https://habr.com/ru/post/917749/


All Articles