I would like to grant the Syncthing app write access to external storage in Marshmallow. The app does not request it explicitly (unlike other apps that seem to use the Storage Access Framework to do so).

In the app permissions screen, there is no permission listed for external storage, only for 'storage' (which seems to mean internal storage). So there does not seem to be any direct way to grant this permission.

My phone is rooted and I could just run Syncthing as root - but this option creates many problems and sometimes results in the app hanging indefinitely.

Is there any other way around this problem?

  • This appears to be an XY problem. Your problem is X and you think Y is the solution so the whole question appears to be about doing Y instead of solving X. // If your apps hangs, then contact the developer and seek assistance from them. Note that you cannot grant a permission which has not been requested (actually you can but it wouldn't achieve anything) by an app.
    – Firelord
    Feb 25, 2016 at 16:24
  • I appreciate your point. However, it would 'achieve' something in the sense that the app is perfectly capable of writing to these folders and in fact is attempting to do it. Android is blocking it from doing so.
    – ShankarG
    Feb 25, 2016 at 16:49
  • Other permissions can be granted without being requested - for instance, using the earlier app ops apps in earlier versions of Android (when rooted), or granting permissions in the current settings screen. The problem is that this permission is not listed.
    – ShankarG
    Feb 25, 2016 at 16:50
  • @ShankarG The permissions an app will request access for when it is being installed is defined at its androidmanifest.xml file that is stored under the base.apk file which can be found at /data/app/<app's package name>
    – SarpSTA
    Feb 25, 2016 at 16:59
  • I'm not sure if the link you provided is for Android, but if what you're using is Wrapper of syncthing for Android, then it's already requesting writing to external storage permission
    – Andrew T.
    Feb 26, 2016 at 4:33

2 Answers 2


You could manually add the related permission to write on external storage to AndroidManifest.xml but it won't work.

I found myself in a situation similar to yours, and I also tried to decompile the app, add the WRITE_EXTERNAL_STORAGE permission request to the AndroidManifest.xml and recompile the package, but it didn't work.

Since Lollipop, Android's new policy concerning the external SD requires any app which needs access to the above-mentioned to use the DocumentProvider interface. Unless you prefer to work in Smali, there's no way to implement it without the Java source code. Just editing the Manifest is not enough.

So, no. There's no way to manually add a working WRITE_EXTERNAL_STORAGE permission, neither in Lollipop or in Marshmallow. Your only choice is to ask the dev to implement it.


I do this for the AMAZING terminal app Termux which for reasons that I do not understand also does not request this permission.

The procedure is rather complicated, involving copying and editing an xml file manually, and puts you at risk of preventing your system from booting. You'll also need to do it again every time the app updates. I guess if you use an editor that has root access you wouldn't have to worry about the copying part. Hmm. Maybe I should do it that way too, actually.

The following are the steps I use to fix perms for Termux. You'll have to adapt them to work for your app. They should probably be the same except for the full app name.

If you're not familiar with XML you should be suuuper hesitant to try this as you'll probably render your phone unbootable if you make an error.

  • Make sure you're not updating apps (turn off auto-update) or doing anything else which could result in modifications to the packages xml file while you're editing it.
  • Start a session in Terminal Emulator. su - in this session to give yourself root permissions.
  • cd /data/system
  • ls -l packages.xml
    • write down the permissions and ownership of packages.xml. They will be essential later.
    • When I did this ten minutes ago, these values were still -rw-rw---- system:system as they have been for the however many years I've been doing this. Might be different on a different type of phone.
  • cp packages.xml packages.xml.orig to make a backup copy of this very important system file
  • cp packages.xml /storage/emulated/0/tmp, or some other location depending on how your phone's file system is laid out. If that directory doesn't exist, just create it.

Now edit the file whichever way you prefer (I use vim under Termux, but use whatever text editor) to make the following change:

  • Find the second line containing /name="com.termux"/. It should be a shared-user tag (i.e. a line starting with <shared-user)
    • For your app this might end up being a different line containing the full name of your app, depending on whether your app has an entry in the earlier section in this file. There might also not be a permissions entry for your app, in which case you'll have to make one from scratch, I guess. I would think this would probably be okay but I really don't know; you might cause system issues by doing so. Caveat emptor. But yeah if you find this node for Termux and copy it and paste the copy below Termux's entry that would probably work.
  • Copy the last <item ... /> line and paste it right underneath.
  • Edit the pasted line to change the permission (currently mine has WAKE_LOCK) to read WRITE_MEDIA_STORAGE.
  • so the last node within the <perms> node should be
    • <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />

Save the file and exit your editor and go back to your Terminal window (where you still have a root session running in /data/system).

  • cp /storage/emulated/0/tmp/packages.xml .
    • Use cp here and NOT mv as mv doesn't set the permissions correctly.
  • VERIFY that the permissions are the same as they were when you started. This is VERY IMPORTANT because the phone won't boot if the perms are wrong. I did this once and managed to rescue it somehow, I forget how.

At this point you should be good to reboot. It's probably prudent to do a diff packages.xml packages.xml.orig1 or whatever to verify that you made the change correctly.

After you reboot your app should have write access to the external SD card. Good luck!

If anyone is aware of a cleaner way to do this, please let me know! This is clunky AF and carries no small risk of having to spend another hour afterward fixing my phone.

You must log in to answer this question.

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