this post was submitted on 14 Sep 2024
18 points (95.0% liked)

Android

27933 readers
162 users here now

DROID DOES

Welcome to the droidymcdroidface-iest, Lemmyest (Lemmiest), test, bestest, phoniest, pluckiest, snarkiest, and spiciest Android community on Lemmy (Do not respond)! Here you can participate in amazing discussions and events relating to all things Android.

The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:

Rules


1. All posts must be relevant to Android devices/operating system.


2. Posts cannot be illegal or NSFW material.


3. No spam, self promotion, or upvote farming. Sources engaging in these behavior will be added to the Blacklist.


4. Non-whitelisted bots will be banned.


5. Engage respectfully: Harassment, flamebaiting, bad faith engagement, or agenda posting will result in your posts being removed. Excessive violations will result in temporary or permanent ban, depending on severity.


6. Memes are not allowed to be posts, but are allowed in the comments.


7. Posts from clickbait sources are heavily discouraged. Please de-clickbait titles if it needs to be submitted.


8. Submission statements of any length composed of your own thoughts inside the post text field are mandatory for any microblog posts, and are optional but recommended for article/image/video posts.


Community Resources:


We are Android girls*,

In our Lemmy.world.

The back is plastic,

It's fantastic.

*Well, not just girls: people of all gender identities are welcomed here.


Our Partner Communities:

[email protected]


founded 1 year ago
MODERATORS
 

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 ?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 2 months ago (1 children)

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.

[–] [email protected] 3 points 2 months ago (2 children)

I am talking about some devices using /sdcard to mount internal storage.

[–] [email protected] 2 points 2 months ago* (last edited 2 months ago)

True, but presumably op probably has an sd card if they say they do.

Edit: I see both ways of reading their statements on re-reading them.

[–] [email protected] 2 points 2 months ago (1 children)

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.

[–] [email protected] 2 points 2 months ago

something that isn’t an SD card to the /sdcard directory?

Could be.

On my phone (Poco X3 Pro - stock Android 11, MIUI 12) the /sdcard is a symlink pointing to /storage/self/primary which itself is a symlink pointing to /storage/emulated/0, which is /data/media, the user-accessible portion of internal storage.
Though from what I can find it anyway is just emulated FAT filesystem which is actually ext4 under that.

Something about backwards compatibility as the directory used to actually be used for SD cards in the past.