Paramount
Paramount

Reputation: 1107

Rooted Android - create and read files in root owned directories

I have seen this questioned asked a couple times but it's never been fully answered (that I can find).

To be clear, my phone is rooted.

What I need to do is read and write files under root owned directories, such-as, /data. I understand I need to run it has a superuser (Runtime.getRuntime().exec("su");). But I can't figure out how to do the IO its self.

Upvotes: 2

Views: 2346

Answers (1)

Nikolay Elenkov
Nikolay Elenkov

Reputation: 52936

Copy the file to the SD card using something like su -c cp /data/file.txt /mnt/sdcard, read it and delete it when done.

Upvotes: 3

Related Questions