I am running adb on emulators and by default, the emulators give root access. When I execute 'adb shell', I get root access to the emulator(virtual device).

For some reason, I want to have non-root access to emulators. What shall I do ?

Any help would be appreciated.


Ubuntu 13.10, 32-bit.

Eclipse 4.2 with ADT bundle.

Genymotion Emulator(To be specific, I was using Android 4.3 here).

  • 1
    You could try su shell to become the "shell user". That's the one adb shell normally uses on devices. But I'm not sure if it is available on the emulator, so please let us know if it works. If the shell user is not available, you could check ls -l /data/data to pick the user of some app to try with.
    – Izzy
    Jan 7, 2014 at 8:16
  • @Izzy - 'su shell' does not work with emulators. I am working on this issue and hopefully very near to solution. Will definitely let you know as it is done. Jan 7, 2014 at 16:30

1 Answer 1


On the SDK emulators and virtual machines like Genymotion, adbd starts up as root and provides a root shell. Short of modifying the source code to do otherwise and rebuilding your VM images, I think you will have to use the su approach suggested above. su shell does indeed work on both SDK emulators as well as the Genymotion VMs. Specifically:

ubuntu$ adb shell
android# id
uid=0(root) gid=0(root) context=u:r:shell:s0
android# su shell
android$ uid=2000(shell) gid=2000(shell) context=u:r:su:s0

Note that the initial shell is running as uid 0 and after su shell is running as uid 2000. In fact, you can su to any Linux uid (Android userId+appId) configured on your emulator/VM. For example, after doing adb shell from Ubuntu:

android# su u0_a16
android$ id
uid=10016(u0_a16) gid=10016(u0_a16) context=u:r:su:s0

On my emulator, uid 0010016 is the calendar app for user 0 (owner, userId 00). Remember that after you su, you only have the privileges of the new uid, and this may not include permissions to run Linux commands or view certain directories.

Finally, if you just need to do one or two operations as the non-root user, you can string the whole thing together as one command in Ubuntu. Something like:

ubuntu$ adb shell su u0_a16 id
uid=10016(u0_a16) gid=10016(u0_a16) context=u:r:su:s0


ubuntu$ adb shell su radio cat /data/data/com.android.phone/shared_prefs/*.xml\; su radio id
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
    <boolean name="_has_set_default_values" value="true" />
uid=1001(radio) gid=1001(radio) context=u:r:su:s0

Above tested on SDK x86 emulator running 4.4.2 and Genymotion VM running 4.4.2.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .