For quick steps just check summary. If interested to know details, go on to read below.
adb is a daemon. Doing ps adb
we can see its process.
shell@grouper:/ $ ps adb
USER PID PPID VSIZE RSS WCHAN PC NAME
shell 133 1 4636 212 ffffffff 00000000 S /sbin/adbd
I just checked what additional property variables it is using when adb is running as root and user.
adb user mode :
shell@grouper:/ $ getprop | grep adb
[init.svc.adbd]: [running]
[persist.sys.usb.config]: [mtp,adb]
[ro.adb.secure]: [1]
[sys.usb.config]: [mtp,adb]
[sys.usb.state]: [mtp,adb]
adb root mode :
shell@grouper:/ # getprop | grep adb
[init.svc.adbd]: [running]
[persist.sys.usb.config]: [mtp,adb]
[ro.adb.secure]: [1]
[service.adb.root]: [1]
[sys.usb.config]: [mtp,adb]
[sys.usb.state]: [mtp,adb]
We can see that service.adb.root
is a new prop variable that came up when we did adb root.
So, to change back adb to user from root, I went ahead and made this 0
setprop service.adb.root 0
But this did not change anything.
Then I went ahead and killed the process (with an intention to restart the process). The pid
of adbd
process in my device is 133
kill -9 133
I exited from shell automatically after I had killed the process.
I did adb shell
again it was in user mode.
SUMMARY :
So, we have 3 very simple steps.
- Enter adb shell as a root.
- setprop service.adb.root 0
- kill -9
(pid of adbd)
After these steps just re-enter the shell with adb shell
and you are back on your device as a user.