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.)

4
  • 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
    Commented Dec 10, 2016 at 8:52
  • Yes I think that's what I mean. Thanks for clarifying. I changed the question accordingly.
    – Forivin
    Commented Dec 10, 2016 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
    Commented Dec 10, 2016 at 14:22
  • I don't know. Maybe there is another way. Like disabling FUSE and creating a symlink.
    – Forivin
    Commented Dec 10, 2016 at 14:31

1 Answer 1

2
+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.
3
  • 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
    Commented Dec 9, 2016 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. Commented Dec 10, 2016 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
    Commented Dec 10, 2016 at 14:29

You must log in to answer this question.

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