User Apps and Data are stored in /data/app
and /data/data
respectively. But we can't (even) see that without root permission. So, I want to know If device is non-rooted then How user Apps are installed (Apks are copied) to /data/app
and how user Apps writes data into /data/data
? In other words : What allow/permit Apps to write data without root-access?
-
See page 1 and 2 here: newandroidbook.com/Book/2-Excerpt-Data.pdf– Firelord ♦Commented Aug 31, 2015 at 13:10
1 Answer
The Android system does not have the conventional /etc/passwd storage for users and groups. In android, user and groups are used to isolate processes and grant permissions. The Android system creates a user per application when an application gets installed. Hence application data files are stored in /data/data/<app-name>/
, and are read-writable only by that application process.
Here is a part of the output of ls -l /data/data
:
drwxr-x--x u0_a31 u0_a31 2015-03-29 15:34 com.lenovo.themecenter
drwxr-x--x u0_a82 u0_a82 2015-02-27 23:20 com.lenovo.videoplayer
drwxr-x--x u0_a75 u0_a75 2013-12-31 21:30 com.lenovo.weatherserver
drwxr-x--x u0_a39 u0_a39 2013-12-31 21:30 com.lenovo.widetouch
drwxr-x--x u0_a73 u0_a73 2015-02-25 22:51 com.lenovo.wifiswitch
drwxr-x--x u0_a19 u0_a19 2013-12-31 21:30 com.lenovo.xlauncher
You will easily notice that each folder is created with read/write permissions only to the corresponding user/group of the app.
More about it here.