I'm using the Terminal Emulator app on a non-rooted Android 5.0.2 phone.

When moving files from a folder of the external SD card to another with:

mv /storage/extSdCard/DCIM/Camera/* /storage/extSdCard/phone/

I get:

mv: rename /storage/extSdCard/DCIM/Camera/20170519_161315.jpg to 
     /storage/extSdCard/phone/20170519_161315.jpg: Permission denied

Is there a solution for this (without rooting the phone)?

Note: ls -la in /storage/extSdCard gives:

drwxrwx--x root     sdcard_r          2016-08-10 02:18 Android
drwxrwx--- root     sdcard_r          2016-11-20 09:45 DCIM
drwxrwx--- root     sdcard_r          2017-05-19 15:46 phone
  • Writing to physically extetnal SD card is not allowed since pre-KK days. But it's possible to write to app's private directory under /storage/extSdCard/Android/data/. You can move files there. – Irfan Latif Oct 4 at 21:18

It seems you can't. Phone is not in the list of folders that are accessible without root.

Last but not least, you can try to access it with run-as command, on behalf of some app.

run-as com.some.package ls -l /data/data/com.user.app run-as com.some.package rm /data/data/com.user.app/databases/db.db

The only pitfall here is that not any package is appropriate for this. The package on behalf of which you can run it should be released with debuggable flag.

Otherwise you just get:

shell@android:/$run-as com.android.backupconfirm run-as: Package 'com.android.UserDict' is not debuggable

  • Thanks @Suncatcher. How can I add phone or any other folder to the list of authorized folders for writing? – Basj May 29 '17 at 12:47
  • Or: is there another emulator app than Terminal Emulator that would have the permission to write on /storage/extSdCard/ ? – Basj May 29 '17 at 18:42
  • It's not the matter of Emulator, it's matter of Android permission system. No way to add. – Suncatcher May 29 '17 at 19:20
  • We could imagine an app @Suncatcher that asks, when installing, "Permission needed by the app : Internet (as usual for apps), Writing on external SD card" etc. – Basj May 29 '17 at 19:26

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.