When installing an app, depending on the app, access to the filesystem is required and requested at the time of install. Is it possible to restrict this to specific folders(s) and their subfolders? For example a photo editor or diary app: why would such apps need to be able to access the whole filesystem.

If not it might not be a bad idea, security-wise...

  • 2
    1) May be I missed it but I don't remember an Android permission related to access to filesystem but only to shared storage. 2) Android uses Linux kernel so you can always restrict files and folders for something by using groups. // That said, your idea is broad to me, so I suggest you pin-point the specific issue you're having.
    – Firelord
    Commented Jul 22, 2015 at 9:54
  • If you don't need access (except for app-specific folders), simply don't request any. By default, each app can write to its own storage space, i.e. /data/data/<package_name> and /sdcard/Android/data/<package_name>. A photo editor would need "full access" if you want to edit existing photos residing outside that scope, of course. // Apart from that, what is the background of your question? What permission to request is a decision of the app developer we users cannot deal with.
    – Izzy
    Commented Jul 22, 2015 at 12:49
  • It's not clear which filesystem and directories OP is asking about. Either it's about completely private storage or private directories in shared storage or public shared storage or operating system partition (/system etc.) Commented Feb 15, 2020 at 22:25

1 Answer 1


Could work in theory.

Every app installed on an android phone is given a user id starting from 10000 for the first app and a group with the same id is created.

BusyBox (and root, maybe?) required!

To get the uid of an app, execute the following in a terminal emulator.

dumpsys package com.example.myapp

Replace com.example.myapp with the package name of your target app.

  1. Format your storage (external/internal) with ext4, assuming you have a backup of all the files.
  2. Restore the backup.
  3. chown and chmod the folders you want to restrict. Basing your restrictions on groups will be a better option.

Again, it's just theory. May or may not work. If you didn't understand any of the steps, get proper knowledge about them or don't try them. This may cause temporary as well as permanent data loss.

  • In Android's storage design formatting external storage with ext4 is not possible. It's shared storage among many UIDs, so a permission-less filesystem is used. Commented Feb 15, 2020 at 22:28
  • @IrfanLatif You are meant to format using ext4 yourself. Never once did I say that it came with ext4. It has been possible to get your sdcard recognized with a non-default fs for some devices. Except emulated sdcard and other external storage, all storage paths are already restricted based on apps uid. Commented Feb 16, 2020 at 3:39

You must log in to answer this question.

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