How to get superuser permission in terminal emulator?

Hi All,

I have installed terminal emulator via adb install, and I’m wondering how can I run as superuser in terminal emulator? When I type su, it gives me a message says “su: can’t execute: Permission denied”

I have tried to following the instructions in this link: How to start Android Terminal Emulator as root – /jdrch , but it does not work on my HiKey 960 board.

Thanks in advance!

That behavior is not supported and not safe.

I believe the default for eng and userdebug builds is to permit root access only via adb (noting that you can configure adb-over-WiFi if you have USB peripherals you wish to keep connected at the same time).

Thanks @doitright and @danielt for your replies! I will need USB OTG to connect other devices so I guess I try with adb over WiFi then.

What are you trying to accomplish?

Fundamentally I was trying to build librealsense on HiKey 960. (That’s why I need OTG to connect the sensor) I saw one relevant post in this forum before but that one didn’t get into any details for realization. Do you happen to know anyone had tried this before?

Can’t say that I’ve even heard of realsense before, let alone know anybody who has worked with it. But what I can tell you from the documentation, is that the issue it needs root for, is simply access permissions to the USB device at the point of running the example code.

IMO, ADB over IP would be by far the simplest way to handle this (much easier than trying to mess around with a terminal running on the hikey). If its too much of a pain to use the wifi, then you also have the UART option.

Another option you have, is to address the permissions themselves. That would likely be by way of edits to the ueventd.rc and sepolicy. These changes would allow you to run the binaries as a normal user (no need for root).

Hi @doitright, thanks for the suggestions. I just gave adb over WiFi a try and failed to run the examples. The error message says “Could not open device. No route to host”, so I guess it’s still a permission issue. I will play around with ueventd.rc file you mentioned and see if I can have any luck with that.

It shouldn’t be a permission issue if you’re running as root [# prompt]. Could be missing a needed driver.

For my 8.1.0 go edition phone. It is /sbin/su/ -c "/system/bin/sh -". I struggle too much to figure out where is su binary file(in my case su binary not exist in the /system/xbin/ path). I found a path /sbin/ is exist in ROOT directory and su binary is exist in that path. And of course i rooted my phone by magisk manager. Hope this answer will help you.