Zhomart
Zhomart

Reputation: 742

How to read/write to file that has only root access on Android?

I have a file /sys/something. And it's owned by root:root and has access level 444.

How can I read and write to the file /sys/something in an android app?

If I change permission of the file, it resets back to the original permissions.

Upvotes: 1

Views: 139

Answers (1)

aka
aka

Reputation: 103

You can try to create root process using:

Process root = Runtime.getRuntime().exec("su");

This process will emulate terminal. You can try to edit file using vim or nano and save it.

I am pretty sure that there is a way to get file stream out of that process, but need to recall how to do that.

Upvotes: 1

Related Questions