Is it possible to change the rights of normal user in android to super user?
My requirement is to run the super user code(I want to read a file data from system directory) in a device that has rooted shell but we can not install any super user manager(SuperSu, Magisk etc.) on that device.
I thought of a solution like following:
- Install an apk in your device that has UI to call the required function on JNI side to start reading data from the file.
- Find the user id of the installed application. I found it in data/system/packages.list file.
- Make file owner is this new user id with su shell.
- Call the required function in the application that further try to open file.
but this solution is not working. The file is not opened by code and return -8002. The errno
is 13.
fd = open("/system/file.txt", O_RDWR | O_LARGEFILE | O_NONBLOCK);
if (fd < 0) {
return -8002;
}
This is very important for us. I shall be very thankful to all who will help me on this.
su
binary? What file do you want to read from /system? May be the required information is available through some Android API.su
process and withoutsu
process an app can not read data from port. e.g. mobileinsight.net/diag-revealer.html These developers are reading data from/dev/diag
port but they actually make an executable and copy the executable to system directory where they have root access. I do not want to use executable and instead want to create a shared library which can directly pass the port data to my android app./system/xbin/su
because of multiple reasons explained here: android.stackexchange.com/a/207902/218526