I'm playing with mount points, directories and files permissions on a rooted MotoG1 using adb (a model without SDCard Slot), and I've come into certain behaviours I can't really understand.
Connected with shell I can see a mounted partition:
$ mount | grep storage /data/media /storage/emulated/legacy esdfs rw,relatime,upper=0:1028:660:771,derive=legacy,nosplit 0 0
In that directory there is a file, which belongs to root, without read persmissions for user shell:
shell@falcon_umts:/storage/emulated/legacy $ ls -l contacts2.db -rw-rw---- root sdcard_r 315392 2016-12-02 16:24 contacts2.db
Since I need to move that file to the host computer using adb pull command, I get root access to change the owner of that file to shell (surprisingly I find the files are located in /data/media/0, not directly in /data/media):
root@falcon_umts:/data/media/0 # ls -l contacts2.db -rw------- root root 315392 2016-12-02 16:24 contacts2.db root@falcon_umts:/data/media/0 # chmod 755 contacts2.db root@falcon_umts:/data/media/0 # ls -l contacts2.db -rwxr-xr-x shell shell 315392 2016-12-02 16:24 contacts2.db
As root, the changes to the file owner seem to be made, but when I get back to the shell account, the file keeps its previous owner.
root@falcon_umts:/data/media/0 # exit shell@falcon_umts:/storage/emulated/legacy $ ls -l contacts2.db -rw-rw---- root sdcard_r 315392 2016-12-02 16:24 contacts2.db
Do you have any idea of the reason of this behaviour? On the other hand if the shell mount point is /data/media, shouldn't be the files on that directory also with root, instead of /data/media/0?