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 ?
But is it an SD card.
I mean, the directory name says so, butβ¦
~ $ realpath /sdcard
/storage/emulated/0
~ $
β¦it may also not be.
It doesnβt matter. FAT filesystems - which are usually the default on SD cards, simply do not support ownership or file permissions. Linux emulates these attributes at mount time, but they apply to the entire SD card. You can mount an SD card and tell Linux to act as if root owns everything on the card; you that you own everything on the card; and it will be so until you unmount it and remount it with a different ownership.
These are filesystem level attributes, not device attributes. If you have a modern internal nvme drive and you format it with vfat, you will not be able to set permissions or ownership at the file level, but only at mount time, for the entire drive.
You mean, theyβre mounting something that isnβt an SD card to the /sdcard directory? Like something truly evil, such as mount -t btrfs -o subvol=@home / /sdcard
? Or do you think thereβs not anything mounted there; itβs just a directory in the root partition? None of that would make any sense.
If theyβre letting whatever automount tool (eg udevil) do its thing, this is practically impossible. And if they know enough to do it by hand, I think theyβd have answered the direct question of βwhich filesystemβ with a filesystem rather than a mount point. Donβt you think? We still donβt know what filesystem theyβre working with, since they havenβt answered the question.