Search code examples
androidandroid-file

Permission denied while trying to read file with 777 on Android


I have a file in /data/data:

# ls -la /data/data/com.package/files/file.json
-rwxrwxrwx u0_a104  u0_a104

I'm trying to read it from different UID (1000, system UID):

new FileInputStream(FILE)

and getting "EACCES (Permission denied)".

API level is 21.

Why, if I've set 777 rights on it?

UPD. I can read the file from adb with uid = 2000 (not root).


Solution

  • Well, I've found out that problem was in SELinux. After disabling SELinux everything is OK.