1

Some people have apparently managed to get Ext4 formatted SD cards to work in their Android devices, allowing them to get file system permission management. I don't have an SD card in my phone, but I want to be able to manage the file permissions on the emulated SD card that all Android devices have.

The problem I see with the current implementation is the fact that apps which can access one file on your SD card (or emulated SD card) can access every single file on your SD card. There is no way to limit access to a single folder.

Now I'm wondering how I can change the emulated SD card in a way that I can specify which app can access which file.
Btw from what I've read, every app has it's own Linux user so in theory it should be as simple as setting permissions with chown/chmod.
But people say that Android has a special implementation for the emulated SD storage, which has been accomplished by using FUSE.

I am aware that apps may not work correctly when they don't have permissions to read or write form that storage. But that shouldn't really be a problem if you manage the permissions with chown/chmod.
I also know that I might lose the ability to use MTP to access that storage from a computer.

I'm using CyanogenMod 13 on a OnePlus One at the moment. Rooted and custom recovery etc. I will upgrade to Android 7 soon (CM14). (also running microG instead of google play services.)

  • 1
    What do you exactly mean by emulated SD card? The Internal Storage emulated from /data partition via FUSE? If yes, /data partition is already formatted as an EXT4 partition in most cases.. – Gokul NC Dec 10 '16 at 8:52
  • Yes I think that's what I mean. Thanks for clarifying. I changed the question accordingly. – Forivin Dec 10 '16 at 12:39
  • 1
    As the answer below says, the only way would be modifying FUSE and compiling the FUSE module yourself.. Even if you set permissions to Internal Storage files from /data/media/0/, that will not be reflected in the emulated storage; that's how it works.. So, your question ultimately reduces to this question: "How do I modify the FUSE module to achieve this?", which I feel it's off-topic here, as said below. – Gokul NC Dec 10 '16 at 14:22
  • I don't know. Maybe there is another way. Like disabling FUSE and creating a symlink. – Forivin Dec 10 '16 at 14:31
3
+25

You seem to be missing the point. Actually a few of them:

  • Emulated SD Card storage has nothing to do with the lack of physical SD card support by some devices.
  • It is a public storage area by design.
  • It is implemented via FUSE - it is not an actual block device and you can not simply reformat it to any filesystem you want.
  • Being able to share files via MTP depends on the current implementation and the change like you are suggesting would break it.
  • I know that it is by design and that I will lose MTP. But I don't care because the security/privacy concern is too big. Would it be possible to use FUSE to change it in a way that I can manage permissions with chown/chmod? And if so, are there any pitfalls? – Forivin Dec 9 '16 at 21:35
  • As the saying goes if you have to ask - the answer is no. The changes you want can not be achieved by few simple shell commands and config changes - you will need to write your own FUSE implementation. While certainly doable - it's an offtopic here. And the obvious pitfalls would include some apps just refusing to work. – Пионерка Dec 10 '16 at 0:30
  • Can you elaborate on you will need to write your own FUSE implementation? Are you 100% certain that this would be the only way? – Forivin Dec 10 '16 at 14:29

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.