3

In Android adb shell, I'm unable to cat a file in a subdirectory of /data/user/0. The error I get is Permission denied.

The ls command on /data/user/0 also returns Permission denied.

Is there any way around this, so I can see the content of the file?

Julian A.
  • 10,928
  • 16
  • 67
  • 107

2 Answers2

3

Further digging reveals that there's a way to achieve this without having root permission if the file belongs to an app that's installed as a debug build. Details here.

In a nutshell:

First, run-as com.foo.app.
Current directory will switch to /data/data/com.foo.app.
Now you can perform permission restricted commands on subdirectories and files, such as cat and ls.

Julian A.
  • 10,928
  • 16
  • 67
  • 107
1

If you want to browse everything like this on your device you need to make your phone with root access to browse the data folders and you need to run adb root instead (in root mode)

Meikiem
  • 1,876
  • 2
  • 11
  • 19