8

So, I'm trying to make an app in android studio and I need to reference a particular file in the app, cascade.xml. I've pushed it onto the emulated phone no problem using adb (it's in the storage/sdcard folder). However, the app still can't access it and I think that's because the file permissions are -rwxrwx--- (which means no global access). These permissions are verified in ADM and using ls -l <filename>

I try to change the permissions of that cascade.xml file by going back into the shell (adb shell) using chmod 777 /storage/sdcard/cascade.xml, but it fails quietly and doesn't do anything. Tried doing other chmods, and nothing happens to it at all. If I do su and then chmod 777 /storage/sdcard/cascade.xml, same thing. Trying to do other chmods like chmod 700 and the like also do nothing (quiet fail).

Now, if I try to make a directory in the folder, I can do that using mkdir - mkdir /storage/sdcard/cascades works fine, and the file permissions of the folder are drwrwx---. However, if I try to use mkdir chmod to create the folder and end up with the same permissions - like mkdir chmod 770 /storage/sdcards/cascades2 - the shell says mkdir failed for chmod, Read-only file system. I can also make text files doing something like echo 'Hello World.' > /storage/sdcard/foo.txt (which creates it with permissions of -rwxrwx---), but if try to chmod it afterwards, nothing happens. If I try to do `echo 'Hello World.' > storage/sdcard/foo2.txt chmod 777, it's the same permission but the file size is 24 instead of 14.

I've done every iteration of mount and remount I can think of, and I still can't get chmod to work properly. I've tried running su in front of everything, and nothing. I've tried starting with adb root, and it says I'm already in root. I can also push stuff the emulator using ADM and adb push. Unfortunately, all of my environment is on a Windows 7 device, so I can't just make a file with -rwxrwxrwx permissions and just transfer it across (unless there's a permission setting in Windows that will make it transfer over as a 777 permission that I don't know about).

Edit: Forgot to mention, the emulated phone is running API 19, target Google APIs (x86 System), running KitKat.

1 Answer 1

16

Figured it out - seems like you just can't change permissions for files on sdcard. Moved it to data/local and chmod worked like a charm.

You must log in to answer this question.

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