How does adb shell differ from a terminal emulator? I have a couple of tasks I want to accomplish on Android 6.0.1 and they need root access when I run them on the device. This target device is not rooted.

Can I use adb from a PC to run commands just as if I would using a Terminal Emulator on a rooted Android?  I thought adb gives some sort of unrestricted temporary access (like temporary root).
I thought adb gives some sort of unrestricted temporary access (like temporary root).


When you open an ordinary terminal emulator app, you're shown a terminal and are automatically logged in as a particular user. The User ID of this particular user is the user ID of your displayed terminal emulator app. Such user and app is considered untrustworthy and is not allowed to do quite a lot of things. You can see the blacklisted items in the source code of untrusted_app.te.

ADB on the other hand when interfaces with the device gets to use the user ID 2000. This user is called shell and can do quite a lot of things for the purpose of debugging but still cannot meet the intricate demands of an end user1. Unless the Android offers a mechanism to switch to another user at will (such as 'su'; not graphical but console), the end user is limited to make any good use of shell user only when device is connected to PC in debugging mode. Follow the source code of shell.te to know about the privileges shell user enjoys.

In short, if the Android is not rooted shell user obviously comes as a winner because of privileges granted to it in contrast to an untrustworthy user, but it does not serve as a good substitute for superuser (su). In addition to that, as I noted above it comes with a cost. 

Related resource: user IDs which come defined in Android



1 Temporary or otherwise, root user always have the user ID 0.