Can android emulator be used to run python scripts as root?

Using the Android Scripting Environment (ASE), I can run Python scripts on the Android emulator that comes with the SDK. However, I want to run scripts as root / superuser for some reason, like creating log files and some others.

Just like real phones, is it possible to implement an emulator to execute these scripts as root or some kind of superuser?

Thanks in advance.

+2


a source to share


2 answers


You always have root in Android emulator. To prove it, open a shell and type:

# su
# whoami
root

      



As for running scripts as root, you can do it from the shell, but not from within ASE at this time. This is tracked by issue 184 . You can launch it if you want to receive notifications if supported.

0


a source


No, we are not always root. for security reasons, root access has been patched by Google in current releases. We get root only after a reboot, which is also not permanent, it disappears on the next reboot.

and "su" returns "uid not allowed to 10045".



This is in the case of an emulator, but on a real device, root can be easily obtained!

0


a source







All Articles