How to restart adb from root to user mode?

mk.. picture mk.. · Mar 11, 2013 · Viewed 101.1k times · Source

Basic question on ADB.

adb root restarts adb as root. But what i want is to restart it back to user after some time.

I tried the following :

adb kill-server
adb start-server

doesnt work..

ps -A -> noted the process number of adb and killed it.. even this did not work. Finally i am restarting my device. Is there any way i can come back from root adb to general adb?

Thank you.

Answer

Alex P. picture Alex P. · Mar 11, 2013

adb kill-server and adb start-server only control the adb daemon on the PC side. You need to restart adbd daemon on the device itself after reverting the service.adb.root property change done by adb root:

~$ adb shell id
uid=2000(shell) gid=2000(shell)

~$ adb root
restarting adbd as root

~$ adb shell id
uid=0(root) gid=0(root)

~$ adb shell 'setprop service.adb.root 0; setprop ctl.restart adbd'

~$ adb shell id
uid=2000(shell) gid=2000(shell)