2

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?

1

1 Answer 1

10

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .