All files in /storage/emulated/0 and /storage/emulated/legacy have permissions of -rw-rw---- and are owned by root and of the group sdcard_r. Even as root, if I do chmod 755 foo.bar it won't change permissions. So, I cannot run scripts or even write files.

I have a rooted Samsung S3 Android 4.4 phone.

Thanks in advance!

  • 1
    A script can be run without setting +x bit. What kind of script is it? How are you running it? Know that Android implements FAT style FUSE to emulate /data/media/0/ at /storage/emulated so changing file permission is out of scope. Since the device is rooted, you can put the file under /data/media/0/ and then try changing permissions or whatsoever you intend to. – Firelord May 21 '16 at 23:15
  • Firelord - Thanks for the information. I din't know that! Also, the scripts are varying: shell, python, even compiled code. I'm running it from the shell: e.g. ./script. Just to be clear, I do have #!/system/bin/sh or whatever as the first line of my scripts (except for the compiled code). – Raveneus Utopia May 21 '16 at 23:43

Since the mountpoints under /storage are managed through FUSE, they do not support permission and ownership editing.

To change permissions and/or ownership for a file stored in the internal SD, you have to navigate to /data/media/0 (provided you have root permissions), and execute chmod or chown from there. Only then will you be able to launch said script, and only from the above path.

For the external SD, follow the same procedure, but use /mnt/media_rw/sdcard1 (or the appropriate folder under /mnt/media_rw/), instead of the internal SD path.

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.