Hi,

I would like to change the owner of a directory on the sdcard /sdcard/aDirectory

I have a terminal installed on my Android 10 (LineageOS 17) com.android.terminal

sudo is not present so I use su and it works.

su
#Terminal was granted Superuser rights

cd /sdcard
chown 10:10 aDirectory
#I don't get any error message.

stat aDirectory
#Uid (0/root)

So the owner stay root no matter what I’m doing, any ideas ?

  • Skull giver
    link
    fedilink
    English
    45 days ago

    Android users all kinds of overlays over the sdcard directory. This is part of how it enforces storage access for apps. There’s probably a way to override these settings, but they sure as hell aren’t easy.

    There’s also another layer of permissions somewhere seeing as I can’t access certain files on /sdcard that were created by the recovery. I assume it’s an selinux context issue (it always is).

    Changing ownership should work on real SD cards with normal storage, but it won’t for the emulated internal /sdcard.