There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

`chown` on a sdcard directory impossible...

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.


<span style="color:#323232;">su
</span><span style="font-style:italic;color:#969896;">#Terminal was granted Superuser rights
</span><span style="color:#323232;">
</span><span style="color:#62a35c;">cd</span><span style="color:#323232;"> /sdcard
</span><span style="color:#323232;">chown 10:10 aDirectory
</span><span style="font-style:italic;color:#969896;">#I don't get any error message.
</span><span style="color:#323232;">
</span><span style="color:#323232;">stat aDirectory
</span><span style="font-style:italic;color:#969896;">#Uid (0/root)
</span>

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

PetteriPano ,
@PetteriPano@lemmy.world avatar

What filesystem do you have on that SD-card? Likely FAT32, which does not support ownership.

user224 ,

But is it an SD card.

I mean, the directory name says so, but…


<span style="color:#323232;">~ $ realpath /sdcard
</span><span style="color:#323232;">/storage/emulated/0
</span><span style="color:#323232;">~ $
</span>

…it may also not be.

9point6 , (edited )

Unless the SD card is using a Linux filesystem, you won’t be able to use Linux access permissions.

Most SD cards are preformatted to FAT or exFAT in order to maximise compatibility. If you don’t need to use the card on any non-linux devices you should be able to reformat it and gain the ability to chown/chmod (should go without saying, but back up any data on the card you want to keep before this)

chakli ,

If you want to change the owner of fat partition, you can do it while mounting, e.g. mount -t fat -o uid=10,gid=10 …

drwankingstein , (edited )

Nine times out of ten, running chown on Android is an astronomically bad idea. 10 times of 10, what you’re trying to do right now, is an astronomically bad idea.

What is it you are trying to do? Or rather, why?

skullgiver ,
@skullgiver@popplesburger.hilciferous.nl avatar

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.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines