Basic reference: How can I mount an ext4-formatted SD card with correct permissions (with root)?
I succeeded to make a partition with ext4 filesystem on the SD card, and I mounted successfully following the reference above. However, I still found that the permission issue is there if I want to copy some files from Linux systems to SD card.
I found that the gid of media_rw is 1023, therefore I created a group on Linux system as such:
# groupadd -g 1023 media_rw
# gpasswd -a USER media_rw
After that, I can modify data on sdcard. However, if I create some new files, the owner & group will be that of USER and the mode is 755 or 644, not 775 or 664. Everytime I need to run a root shell and
$ find . -type f -exec chmod 664 {} \;
# chown -R 1023:media_rw .
It's very annoying. I wonder what's the correct way to exchange data for cyanogenmod.
Any help? Thanks!
EDIT: I found a method to set permissions except the owner:
$ rsync -r -p --chmod=D775,F664 -g --chown=:media_rw SOURCE DEST
sudo su - media_rw
and work as that when creating files. As for the permissions, checkman umask
to set theumask
correctly in~media_rw/.profile
. // Besides, that's not really an Android question. Wait until your apps create files there and see by whom they're owned ;) – Izzy Jul 02 '15 at 12:50/help/on-topic
). I see/share your points for extfs, but not sure how Android deals with it on sd card. – Izzy Jul 03 '15 at 06:23