3

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?

11

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.