Can't use chmod to alter permissions on emulated phone


Question

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.


Answer

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.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes